Locks and Condition Variables
The package "util" provides lock and condition variable classes.
- Lock - has methods get( ) and put( ) to obtain and release an exclusive lock.
- ReadWriteLock - has methods getReader( ), putReader( ), getWriter( ), and putWriter( )
to manage a shared-read, exclusive-write lock.
- Condition - an abstract class, with methods get( ), put( ), and clear( ).
Typical code waits on a condition by calling get( ); somebody else calls
put( ) to grant access to a resource, or clear( ) to prevent any further calls
to get( ) from succeeding.
- SharedCondition - after a put( ), lets all get( ) calls succeed until a
call to clear( ). A SharedCondition typically indicates that a read-only
resource has become available.
- ExclusiveCondition - after a put( ), a single caller of get( ) will continue
- DelayedCondition - a failed attempt to simplify the code for the DVI Controls