Etienne Gagnon wrote:

Here's what the JNI spec says about it:

 MonitorExit

 Prototype jint MonitorExit(JNIEnv *env, jobject obj);

 ...

 Native code must not use MonitorExit to exit a monitor entered through
 a synchronized method or a monitorenter Java virtual machine
 instruction.

So, the current AWT code clearly does something that the JNI spec does
not allow for.


OK. It might be possible to fix this by moving the synchronization to the Java level. eg in EventQueue.getNextEvent():

synchronized (queueLock)
 {
   ...
   callGtkThreadsEnter();
 }
tk.iterateNativeQueue();
synchronized (queueLock)
 {
   callGtkThreadsLeave();
   ...
 }

However, implementing this approach is not quite as simple because iterateNativeQueue() is called more than once and also called within nested flow control. A redesign of getNextEvent() is probably needed - converting some of the if and while constructs into local state variables which determine whether or not iterateNativeQueue() should be called.

Bryce



_______________________________________________
Classpath mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to