summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/GLContextLock.java
diff options
context:
space:
mode:
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);
+ }
}