public class PriorityMutex extends Object
Constructor and Description |
---|
PriorityMutex() |
Modifier and Type | Method and Description |
---|---|
Thread |
getLockThread()
Return a thread that acquired this mutex.
|
protected boolean |
isPriorityThread()
Return true if the current thread that is entering this method
is a priority thread
and should be allowed to enter as soon as possible.
|
boolean |
isPriorityThreadWaiting()
Can be called by the thread
that acquired the mutex to check whether there
is a priority thread (such as AWT event-notification thread)
waiting.
|
void |
lock()
Acquire the ownership of the mutex.
|
String |
toString() |
void |
unlock()
Release the ownership of the mutex.
|
public void lock()
The following pattern should always be used:
mutex.lock(); try { ... } finally { mutex.unlock(); }
public void unlock()
PriorityMutex.lock()
public boolean isPriorityThreadWaiting()
public final Thread getLockThread()
null
if there is currently no thread holding that acquired this mutex.protected boolean isPriorityThread()
The default implementation assumes that
SwingUtilities.isEventDispatchThread()
is a priority thread.