diff options
Diffstat (limited to 'src')
4 files changed, 28 insertions, 13 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java index cadef9bf1..4f6c0d155 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java @@ -53,12 +53,12 @@ public class GlobalToolkitLock implements ToolkitLock { @Override public final void lock() { globalLock.lock(); - if(TRACE_LOCK) { System.err.println("GlobalToolkitLock.lock()"); } + if(TRACE_LOCK) { System.err.println(Thread.currentThread()+" GlobalToolkitLock: lock() "+toStringImpl()); } } @Override public final void unlock() { - if(TRACE_LOCK) { System.err.println("GlobalToolkitLock.unlock()"); } + if(TRACE_LOCK) { System.err.println(Thread.currentThread()+" GlobalToolkitLock: unlock() "+toStringImpl()); } globalLock.unlock(); // implicit lock validation } @@ -74,6 +74,9 @@ public class GlobalToolkitLock implements ToolkitLock { @Override public String toString() { - return "GlobalToolkitLock[obj 0x"+Integer.toHexString(hashCode())+", isOwner "+globalLock.isOwner(Thread.currentThread())+", "+globalLock.toString()+"]"; + return "GlobalToolkitLock["+toStringImpl()+"]"; + } + private String toStringImpl() { + return "obj 0x"+Integer.toHexString(hashCode())+", isOwner "+globalLock.isOwner(Thread.currentThread())+", "+globalLock.toString(); } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java index bda20522c..bbfb585ac 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java @@ -42,14 +42,14 @@ public class NullToolkitLock implements ToolkitLock { @Override public final void lock() { if(TRACE_LOCK) { - System.err.println("NullToolkitLock.lock()"); - // Thread.dumpStack(); + System.err.println(Thread.currentThread()+" NullToolkitLock: lock() "+toStringImpl()); + // ExceptionUtils.dumpStackTrace(System.err, 1, 4); } } @Override public final void unlock() { - if(TRACE_LOCK) { System.err.println("NullToolkitLock.unlock()"); } + if(TRACE_LOCK) { System.err.println(Thread.currentThread()+" NullToolkitLock: unlock() "+toStringImpl()); } } @Override @@ -66,7 +66,10 @@ public class NullToolkitLock implements ToolkitLock { @Override public String toString() { - return "NullToolkitLock[]"; + return "NullToolkitLock["+toStringImpl()+"]"; + } + private String toStringImpl() { + return "obj 0x"+Integer.toHexString(hashCode()); } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java index f1efb8133..e4e557d36 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java @@ -54,12 +54,15 @@ public class ResourceToolkitLock implements ToolkitLock { @Override public final void lock() { lock.lock(); - if(TRACE_LOCK) { System.err.println("ResourceToolkitLock.lock()"); } + if(TRACE_LOCK) { + System.err.println(Thread.currentThread()+" ResourceToolkitLock: lock() "+toStringImpl()); + // ExceptionUtils.dumpStackTrace(System.err, 1, 4); + } } @Override public final void unlock() { - if(TRACE_LOCK) { System.err.println("ResourceToolkitLock.unlock()"); } + if(TRACE_LOCK) { System.err.println(Thread.currentThread()+" ResourceToolkitLock: unlock() "+toStringImpl()); } lock.unlock(); // implicit lock validation } @@ -75,6 +78,9 @@ public class ResourceToolkitLock implements ToolkitLock { @Override public String toString() { - return "ResourceToolkitLock[obj 0x"+Integer.toHexString(hashCode())+", isOwner "+lock.isOwner(Thread.currentThread())+", "+lock.toString()+"]"; + return "ResourceToolkitLock["+toStringImpl()+"]"; + } + private String toStringImpl() { + return "obj 0x"+Integer.toHexString(hashCode())+", isOwner "+lock.isOwner(Thread.currentThread())+", "+lock.toString(); } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java index 5dac74323..881fd56a6 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java @@ -112,12 +112,12 @@ public class SharedResourceToolkitLock implements ToolkitLock { @Override public final void lock() { lock.lock(); - if(TRACE_LOCK) { System.err.println("SharedResourceToolkitLock.lock()"); } + if(TRACE_LOCK) { System.err.println(Thread.currentThread()+" SharedResourceToolkitLock: lock() "+toStringImpl()); } } @Override public final void unlock() { - if(TRACE_LOCK) { System.err.println("SharedResourceToolkitLock.unlock()"); } + if(TRACE_LOCK) { System.err.println(Thread.currentThread()+" SharedResourceToolkitLock: unlock() "+toStringImpl()); } lock.unlock(); } @@ -144,6 +144,9 @@ public class SharedResourceToolkitLock implements ToolkitLock { @Override public String toString() { - return "SharedResourceToolkitLock[refCount "+refCount+", handle 0x"+Long.toHexString(handle)+", obj 0x"+Integer.toHexString(hashCode())+", isOwner "+lock.isOwner(Thread.currentThread())+", "+lock.toString()+"]"; + return "SharedResourceToolkitLock["+toStringImpl()+"]"; + } + private String toStringImpl() { + return "refCount "+refCount+", handle 0x"+Long.toHexString(handle)+", obj 0x"+Integer.toHexString(hashCode())+", isOwner "+lock.isOwner(Thread.currentThread())+", "+lock.toString(); } } |