com.jogamp.common.util.locks
Interface ThreadLock

All Superinterfaces:
Lock
All Known Subinterfaces:
RecursiveLock, RecursiveThreadGroupLock

public interface ThreadLock
extends Lock

Extending the Lock features with convenient functionality.


Field Summary
 
Fields inherited from interface com.jogamp.common.util.locks.Lock
DEBUG, DEFAULT_TIMEOUT, TIMEOUT, TRACE_LOCK
 
Method Summary
 Thread getOwner()
           
 boolean isLockedByOtherThread()
          Query whether the lock is hold by the a thread other than the current thread.
 boolean isOwner(Thread thread)
          Query whether the lock is hold by the given thread.
 void unlock(Runnable taskAfterUnlockBeforeNotify)
          Execute the Runnable taskAfterUnlockBeforeNotify while holding the exclusive lock.
 void validateLocked()
           
 
Methods inherited from interface com.jogamp.common.util.locks.Lock
isLocked, lock, tryLock, unlock
 

Method Detail

isLockedByOtherThread

boolean isLockedByOtherThread()
Query whether the lock is hold by the a thread other than the current thread.


isOwner

boolean isOwner(Thread thread)
Query whether the lock is hold by the given thread.


getOwner

Thread getOwner()
Returns:
the Thread owning this lock if locked, otherwise null

validateLocked

void validateLocked()
                    throws RuntimeException
Throws:
RuntimeException - if current thread does not hold the lock

unlock

void unlock(Runnable taskAfterUnlockBeforeNotify)
Execute the Runnable taskAfterUnlockBeforeNotify while holding the exclusive lock.

Then release the lock.