|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.vishia.java2C.test.TestWaitNotify.WaitNotifyData
public static final class TestWaitNotify.WaitNotifyData
This class is visible from outside, it is used from the notifying thread and from this thread, which waits for data.
| Field Summary | |
|---|---|
(package private) int |
ctNewData
Sequence counter to detect a notify. |
(package private) int |
x
A value which is supplied with notify. |
| Constructor Summary | |
|---|---|
TestWaitNotify.WaitNotifyData()
|
|
| Method Summary | |
|---|---|
void |
notify(int value)
Notify routine, it may be called from outside. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
int x
int ctNewData
| Constructor Detail |
|---|
public TestWaitNotify.WaitNotifyData()
| Method Detail |
|---|
public void notify(int value)
notify()-call
have to be placed in a synchronized- (mutex-)-block. Elsewhere in Java an exception is thrown.
It is necessary to do so. That synchronized-block should be used to set the data,
which are supplied with the notify action. Than the data and the notify-call are mutual exclusive handled.
The Java-code is:
synchronized(this){
x = value;
ctNewData +=1;
notify();
}
The value is stored. The sequence counter is incremented to advertise the notify. Than notify is called.
All this operations are done under mutex in the synchronized-block.
The translated C-code is:
synchronized_ObjectJc(& ((* (ythis)).base.object)); {
ythis->x = value;
ythis->ctNewData += 1;
notify_ObjectJc(& ((* (ythis)).base.object), _thCxt);
} endSynchronized_ObjectJc(& ((* (ythis)).base.object));
value - The value supplied with notify.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||