|
From: | Bryce McKinlay |
Subject: | Re: Unstructured locking bug |
Date: | Mon, 14 Mar 2005 18:06:23 -0500 |
User-agent: | Mozilla Thunderbird 1.0 (X11/20041206) |
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
[Prev in Thread] | Current Thread | [Next in Thread] |