From: <eli...@us...> - 2007-05-18 07:15:37
|
Revision: 2819 http://svn.sourceforge.net/java-game-lib/?rev=2819&view=rev Author: elias_naur Date: 2007-05-18 00:15:35 -0700 (Fri, 18 May 2007) Log Message: ----------- Linux: Removed GCJ workaround since current GCJ versions support re-entrant AWT locking Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2007-05-13 22:01:48 UTC (rev 2818) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2007-05-18 07:15:35 UTC (rev 2819) @@ -67,15 +67,6 @@ private static final int XRANDR = 10; private static final int XF86VIDMODE = 11; private static final int NONE = 12; - - /** Keep track on the current awt lock owner to avoid - * depending on JAWT locking to be re-entrant (This is a - * problem with GCJ). JAWT locking is not that well specified - * anyway so it is probably best to avoid assuming too much - * about it. - */ - private static Thread current_awt_lock_owner; - private static int awt_lock_count; /** Current X11 Display pointer */ private static long display; @@ -212,41 +203,20 @@ * Xlib calls with AWT Xlib calls. Fortunately, JAWT implements Lock()/Unlock() to * do just that. */ - static synchronized void lockAWT() { - Thread this_thread = Thread.currentThread(); - while (current_awt_lock_owner != null && current_awt_lock_owner != this_thread) { - try { - LinuxDisplay.class.wait(); - } catch (InterruptedException e) { - LWJGLUtil.log("Interrupted while waiting for awt lock: " + e); - } + static void lockAWT() { + try { + nLockAWT(); + } catch (LWJGLException e) { + LWJGLUtil.log("Caught exception while locking AWT: " + e); } - if (awt_lock_count == 0) { - current_awt_lock_owner = this_thread; - try { - nLockAWT(); - } catch (LWJGLException e) { - LWJGLUtil.log("Caught exception while locking AWT: " + e); - } - } - awt_lock_count++; } private static native void nLockAWT() throws LWJGLException; - static synchronized void unlockAWT() { - if (awt_lock_count <= 0) - throw new IllegalStateException("AWT not locked!"); - if (Thread.currentThread() != current_awt_lock_owner) - throw new IllegalStateException("AWT already locked by " + current_awt_lock_owner); - awt_lock_count--; - if (awt_lock_count == 0) { - try { - nUnlockAWT(); - } catch (LWJGLException e) { - LWJGLUtil.log("Caught exception while unlocking AWT: " + e); - } - current_awt_lock_owner = null; - LinuxDisplay.class.notify(); + static void unlockAWT() { + try { + nUnlockAWT(); + } catch (LWJGLException e) { + LWJGLUtil.log("Caught exception while unlocking AWT: " + e); } } private static native void nUnlockAWT() throws LWJGLException; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |