Package com.jogamp.common.util.locks
Interface ThreadLock
-
- All Superinterfaces:
Lock
- All Known Subinterfaces:
RecursiveLock
,RecursiveThreadGroupLock
public interface ThreadLock extends Lock
Extending theLock
features with convenient functionality.
-
-
Field Summary
-
Fields inherited from interface com.jogamp.common.util.locks.Lock
DEBUG, DEFAULT_TIMEOUT, TIMEOUT, TRACE_LOCK
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 theRunnable taskAfterUnlockBeforeNotify
while holding the exclusive lock.void
validateLocked()
-
-
-
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 theRunnable taskAfterUnlockBeforeNotify
while holding the exclusive lock.Then release the lock.
-
-