summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-10-09 04:44:09 +0200
committerSven Gothel <[email protected]>2010-10-09 04:44:09 +0200
commit579326db93ebe3d72c6b9f3acf74fadf21ec9f17 (patch)
tree890560308084b0a06c477c22b73cc072292d3036 /src/jogl/classes/com
parent041b1ed7cefea4eebb7ec0eefd2304beecf26081 (diff)
Relocated RecursiveToolkitLock -> gluegen ; NEWT AWTParentWindowAdapter fix & WindowImpl debug change ; Add NEWT/AWT unit test 1 frame - 2 NewtCanvasAWT
Relocated RecursiveToolkitLock -> gluegen com.jogamp.nativewindow.impl.RecursiveToolkitLock -> com.jogamp.common.util.RecursiveToolkitLock NEWT AWTParentWindowAdapter fix - minimize action if status unchanged - added missing isValid() condition before runOnEDT.. NEWT WindowImpl: - debug output only if action triggered (resize/visible) Add NEWT/AWT unit test 1 frame - 2 NewtCanvasAWT - Testing case where AWTParentWindowAdapter provokes both GLWindow instances to resize/visible
Diffstat (limited to 'src/jogl/classes/com')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLContextLock.java19
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java2
2 files changed, 16 insertions, 5 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextLock.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextLock.java
index 6d0c5d984..565ec967e 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextLock.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextLock.java
@@ -51,9 +51,10 @@ import javax.media.opengl.*;
public class GLContextLock {
static class SyncData {
- Thread owner = null;
boolean failFastMode = true;
+ Thread owner = null;
int waiters = 0;
+ Exception lockedStack = null;
}
private SyncData sdata = new SyncData(); // synchronized (flow/mem) mutable access
@@ -65,9 +66,11 @@ public class GLContextLock {
Thread current = Thread.currentThread();
if (sdata.owner == null) {
sdata.owner = current;
+ sdata.lockedStack = new Exception("Previously made current (1) by "+sdata.owner+", lock: "+this);
} else if (sdata.owner != current) {
while (sdata.owner != null) {
if (sdata.failFastMode) {
+ sdata.lockedStack.printStackTrace();
throw new GLException("Attempt to make context current on thread " + current +
" which is already current on thread " + sdata.owner);
} else {
@@ -82,6 +85,7 @@ public class GLContextLock {
}
}
sdata.owner = current;
+ sdata.lockedStack = new Exception("Previously made current (2) by "+sdata.owner+", lock: "+this);
} else {
throw new GLException("Attempt to make the same context current twice on thread " + current);
}
@@ -94,6 +98,7 @@ public class GLContextLock {
Thread current = Thread.currentThread();
if (sdata.owner == current) {
sdata.owner = null;
+ sdata.lockedStack = null;
// Assuming notify() implementation weaks up the longest waiting thread, to avoid starvation.
// Otherwise we would need to have a Thread queue implemented, using sleep(timeout) and interrupt.
sdata.notify();
@@ -112,8 +117,7 @@ public class GLContextLock {
/** Indicates whether this lock is held by the current thread. */
public final boolean isHeld() {
synchronized(sdata) {
- Thread current = Thread.currentThread();
- return (sdata.owner == current);
+ return (Thread.currentThread() == sdata.owner);
}
}
@@ -131,7 +135,14 @@ public class GLContextLock {
public final boolean hasWaiters() {
synchronized(sdata) {
- return (sdata.waiters != 0);
+ return (0 != sdata.waiters);
+ }
+ }
+
+ public final Exception getLockedStack() {
+ synchronized(sdata) {
+ return sdata.lockedStack;
}
}
+
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
index 9f113f337..e2c217ac0 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
@@ -49,7 +49,7 @@ import java.beans.PropertyChangeListener;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.jogamp.nativewindow.impl.RecursiveToolkitLock;
+import com.jogamp.common.util.RecursiveToolkitLock;
/** Platform-independent class exposing pbuffer functionality to
applications. This class is not exposed in the public API as it