aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-10-07 09:53:11 +0200
committerSven Gothel <[email protected]>2014-10-08 22:13:16 +0200
commit29636ef01f4909cd2afdd71f9bb9c26d6bbd26b6 (patch)
treef78c4cd3b436113ed976d775a8269e5fd276f38a
parent4b2552af6ba4b92a039cc1514194d8066e8e1f44 (diff)
NativeWindow's ToolkitLock TRACE_LOCK: Show more usable details
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java9
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java11
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java12
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java9
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();
}
}