summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/GLContextLock.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2006-02-23 08:02:08 +0000
committerKenneth Russel <[email protected]>2006-02-23 08:02:08 +0000
commit5fbc462246a5d40833697902e84f2b2076e735a2 (patch)
treee9072221589216aabd499316efdf6e7296f9dd91 /src/classes/com/sun/opengl/impl/GLContextLock.java
parent76e7d4bd24490eb73914fa7461baf86da17f584d (diff)
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
Diffstat (limited to 'src/classes/com/sun/opengl/impl/GLContextLock.java')
-rw-r--r--src/classes/com/sun/opengl/impl/GLContextLock.java8
1 files changed, 8 insertions, 0 deletions
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);
+ }
}