Locks Flashcards
1
Q
Acquires the lock
A
void Lock()
2
Q
Acquires the lock and returns true if the lock is available. If the lock is not available, it does not acquire the lock and returns false. Has an overloaded version that takes a timeout period to wait before returning false.
A
boolean tryLock()
3
Q
Acquires a lock; if it is interrupted while acquiring the lock, it throws an InterruptedException.
A
void lockInterruptibly()
4
Q
Returns a Condition object associated with this Lock object.
A
Condition newCondition()
5
Q
Releases the lock.
A
void unlock()