| java.lang.Object com.protomatter.util.Mutex
Mutex | public class Mutex (Code) | | A mutex.
|
Constructor Summary | |
public | Mutex() Create a new mutex. |
Method Summary | |
public void | getLock() Obtain the lock on the mutex. | public Thread | getLockingThread() Get a reference to the thread that currently has the lock. | public boolean | isLocked() Determine if this mutex is currently locked by anyone. | public void | releaseLock() Release the lock on the mutex. |
Mutex | public Mutex()(Code) | | Create a new mutex.
|
getLock | public void getLock()(Code) | | Obtain the lock on the mutex. This method blocks, and threads
are stacked in the order they call this method.
|
getLockingThread | public Thread getLockingThread()(Code) | | Get a reference to the thread that currently has the lock.
Returns null if nobody has the lock.
|
isLocked | public boolean isLocked()(Code) | | Determine if this mutex is currently locked by anyone.
|
releaseLock | public void releaseLock()(Code) | | Release the lock on the mutex. Users of this class should be
nice about using this method -- don't call it unless you've
already called getLock(), since this does not check
to make sure the caller is really the lock owner.
|
|
|