diff options
author | Sven Gothel <[email protected]> | 2011-12-11 04:06:06 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-12-11 04:06:06 +0100 |
commit | 8dc2ad6a130c75121bc35e393d1cab89217d4d63 (patch) | |
tree | 517166308137b5c0faf73d927f36dbf946c8f774 /src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java | |
parent | e5aaa05c071e311f1f0d8298dce268a3b44d32ea (diff) |
Cleanup Lock Package: API doc, complete throws declaration, interface RecursiveLockImpl01Unfairish.Sync
RecursiveLockImpl01Unfairish changes are in preparation of RecursiveGroupThreadLock.
Diffstat (limited to 'src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java')
-rw-r--r-- | src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java b/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java index b4e6ce0..7c88400 100644 --- a/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java +++ b/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java @@ -34,11 +34,18 @@ public class RecursiveLockImplJava5 implements RecursiveLock { } public void unlock() throws RuntimeException { + unlock(null); + } + + public void unlock(Runnable taskAfterUnlockBeforeNotify) { validateLocked(); owner = null; + if(null!=taskAfterUnlockBeforeNotify) { + taskAfterUnlockBeforeNotify.run(); + } lock.unlock(); } - + public boolean isLocked() { return lock.isLocked(); } @@ -59,7 +66,7 @@ public class RecursiveLockImplJava5 implements RecursiveLock { return lock.isLocked() && owner == thread; } - public void validateLocked() { + public void validateLocked() throws RuntimeException { if ( !lock.isHeldByCurrentThread() ) { if ( !lock.isLocked() ) { throw new RuntimeException(Thread.currentThread()+": Not locked"); |