From 5fbc462246a5d40833697902e84f2b2076e735a2 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Thu, 23 Feb 2006 08:02:08 +0000 Subject: Added mechanism for kicking the current context off the GLWorkerThread. Tested with modified version of demos.texture.TestTexture doing the loading in another thread with manual makeCurrent()/release() calls (not recommended style). git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@634 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/classes/com/sun/opengl/impl/GLContextLock.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/classes/com/sun/opengl/impl/GLContextLock.java') diff --git a/src/classes/com/sun/opengl/impl/GLContextLock.java b/src/classes/com/sun/opengl/impl/GLContextLock.java index 9fb4d66e5..753ef14f8 100644 --- a/src/classes/com/sun/opengl/impl/GLContextLock.java +++ b/src/classes/com/sun/opengl/impl/GLContextLock.java @@ -52,6 +52,7 @@ public class GLContextLock { private Object lock = new Object(); private Thread owner; private boolean failFastMode = true; + private volatile int waiters; /** Locks this GLContextLock on the current thread. If fail fast mode is enabled and the GLContextLock is already owned by @@ -68,9 +69,12 @@ public class GLContextLock { " which is already current on thread " + owner); } else { try { + ++waiters; lock.wait(); } catch (InterruptedException e) { throw new GLException(e); + } finally { + --waiters; } } } @@ -115,4 +119,8 @@ public class GLContextLock { public boolean getFailFastMode() { return failFastMode; } + + public boolean hasWaiters() { + return (waiters != 0); + } } -- cgit v1.2.3