Package com.jogamp.common.util.locks
Interface ThreadLock
-
- All Superinterfaces:
Lock
- All Known Subinterfaces:
RecursiveLock,RecursiveThreadGroupLock
public interface ThreadLock extends Lock
Extending theLockfeatures 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 ThreadgetOwner()booleanisLockedByOtherThread()Query whether the lock is hold by the a thread other than the current thread.booleanisOwner(Thread thread)Query whether the lock is hold by the given thread.voidunlock(Runnable taskAfterUnlockBeforeNotify)Execute theRunnable taskAfterUnlockBeforeNotifywhile holding the exclusive lock.voidvalidateLocked()
-
-
-
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 taskAfterUnlockBeforeNotifywhile holding the exclusive lock.Then release the lock.
-
-