| |
|
| java.lang.Object org.apache.harmony.awt.wtk.Synchronizer
Synchronizer | public class Synchronizer (Code) | | Class synchronizer is to protect AWT state integrity in multithreading environment.
It is supposed to have a child class per native platform.
The only instance is created on the first use of one of the core AWT classes.
Registers WTK on the dispatch thread startup.
It is just a special kind of mutex.
|
Field Summary | |
protected int | acquestCounter This field holds the counter of lock operation. | protected Thread | dispatchThread | protected Thread | owner This field holds the owner of synchronizer.
Owner of synchronizer is a last thread that successfully locked synchronizer and
still havn't freed it. |
Method Summary | |
public void | lock() Acquire the lock for this synchronizer. | public void | lockAndRestoreState() Locks this synchronizer and restores it's state. | public void | setEnvironment(WTK wtk, Thread dispatchThread) Sets references to WTK and event dispatch thread. | public void | storeStateAndFree() Stores state of this synchronizer and frees it. | public void | unlock() Release the lock for this synchronizer. |
acquestCounter | protected int acquestCounter(Code) | | This field holds the counter of lock operation.
To free synchronizer unlock method must be called $acquestCounter times.
Equals to 0 when synchronizer is free.
|
dispatchThread | protected Thread dispatchThread(Code) | | The event dispatch thread
|
owner | protected Thread owner(Code) | | This field holds the owner of synchronizer.
Owner of synchronizer is a last thread that successfully locked synchronizer and
still havn't freed it. Equals to null when synchronizer is free.
|
lock | public void lock()(Code) | | Acquire the lock for this synchronizer. Nested lock is supported.
If the mutex is already locked by another thread, the current thread will be put
into wait queue until the lock becomes available.
All user threads are served in FIFO order. Dispatch thread has higher priority.
Supposed to be used in Toolkit.lockAWT() only.
|
lockAndRestoreState | public void lockAndRestoreState()(Code) | | Locks this synchronizer and restores it's state.
Supposed to be used in Toolkit.unsafeInvokeAndWaitUnderAWTLock() only in pair with
storeStateAndFree().
Do not call it directly.
|
setEnvironment | public void setEnvironment(WTK wtk, Thread dispatchThread)(Code) | | Sets references to WTK and event dispatch thread.
Called on toolkit startup.
Parameters: wtk - - reference to WTK instance Parameters: dispatchThread - - reference to event dispatch thread |
storeStateAndFree | public void storeStateAndFree()(Code) | | Stores state of this synchronizer and frees it.
Supposed to be used in Toolkit.unsafeInvokeAndWaitUnderAWTLock() only in pair with
lockAndRestoreState().
Do not call it directly.
|
unlock | public void unlock()(Code) | | Release the lock for this synchronizer.
If wait queue is not empty the first waiting thread acquires the lock.
Supposed to be used in Toolkit.unlockAWT() only.
|
|
|
|