Notify routine, it may be called from outside. New data are stored than. The
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));