java.lang.Object
org.cybergarage.util.Mutex
A simple mutex implementation for thread synchronization. This class provides basic locking mechanisms using synchronized methods and wait/notify for inter-thread communication.
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
All Methods
Field Details
syncLock
private boolean syncLockTrue while a thread holds the lock.
Constructor Details
Mutex
public Mutex()Creates a new Mutex instance in the unlocked state.
Method Details
lock
public void lock()Acquires the lock, blocking if necessary until the lock is available. If the lock is already held, the calling thread will wait until it's released.unlock
public void unlock()Releases the lock and notifies all waiting threads. This method should only be called by the thread that currently holds the lock.