org.vishia.java2C.test
Class TestThread.TestThreadLocalData

java.lang.Object
  extended by org.vishia.java2C.test.TestThread.TestThreadLocalData
Enclosing class:
TestThread

private static final class TestThread.TestThreadLocalData
extends java.lang.Object

This class is defined only to use in the threads context. No other thread should have access to it. Therefore the instance can be defined in a thread-local data range. For Java2C it is possible to create a stack-instance. It is done in the TestThread.run(). routine.


Field Summary
(package private)  java.lang.StringBuffer threadownBuffer
          Example for a large data area.
(package private)  float x
           
(package private)  float y
           
 
Constructor Summary
private TestThread.TestThreadLocalData()
           
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

float x

y

float y

threadownBuffer

final java.lang.StringBuffer threadownBuffer
Example for a large data area. The buffer is allocated in C in the class as embedded instance, because the class' instances is allocated in stack, the buffer is located in the stack.

If the Java program takes the reference of the buffer and stores it in another instance, which is accessed from another thread, it is possible in Java because in Standard-Java it's a normal instance in heap. But the implementation in C in a protected memory system will force a memory protection error, because the data area is located in the stack of another thread. The stacks of several threads should not accessible one to another. That is ones of distinctions between a standard Java environment to test and the implementation in a target system. Such errors should recognized in the test of target.

Constructor Detail

TestThread.TestThreadLocalData

private TestThread.TestThreadLocalData()