Top Description Fields Constructors Methods
org.eclipse.swt.widgets

public Class Synchronizer

extends Object
Class Inheritance
Imports
java.util.*, java.util.concurrent.*, org.eclipse.swt.*, org.eclipse.swt.graphics.*

Instances of this class provide synchronization support for displays. A default instance is created automatically for each display, and this instance is sufficient for almost all applications.

Important Note

Typical application code never needs to deal with this class. It is provided only to allow applications which require non-standard synchronization behavior to plug in the support they require. Subclasses which override the methods in this class must ensure that the superclass methods are invoked in their implementations

See Also
Display#setSynchronizer, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv Display
pack-priv static final int
pack-priv static final boolean
pack-priv static final boolean
pack-priv static final int
pack-priv final ConcurrentLinkedQueue<RunnableLock>
pack-priv Thread

Constructor Summary

AccessConstructor and Description
public
Synchronizer(Display
the display to create the synchronizer on
display
)

Constructs a new instance of this class.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
protected void
asyncExec(Runnable
code to run on the user-interface thread.
runnable
)

Causes the run() method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity.

pack-priv boolean
pack-priv void
moveAllEventsTo(Synchronizer
the synchronizer that will receive the events
toReceiveTheEvents
)

Removes all pending events from the receiver and inserts them into the beginning of the given synchronizer's queue

pack-priv void
pack-priv RunnableLock
pack-priv boolean
pack-priv boolean
runAsyncMessages(boolean all)

protected void
syncExec(Runnable
code to run on the user-interface thread.
runnable
)

Causes the run() method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

displayback to summary
pack-priv Display display
GROW_SIZEback to summary
pack-priv static final int GROW_SIZE
IS_COCOAback to summary
pack-priv static final boolean IS_COCOA
IS_GTKback to summary
pack-priv static final boolean IS_GTK
MESSAGE_LIMITback to summary
pack-priv static final int MESSAGE_LIMIT
messagesback to summary
pack-priv final ConcurrentLinkedQueue<RunnableLock> messages
syncThreadback to summary
pack-priv Thread syncThread

Constructor Detail

Synchronizerback to summary
public Synchronizer(Display display)

Constructs a new instance of this class.

Parameters
display:Display

the display to create the synchronizer on

Method Detail

addLastback to summary
pack-priv void addLast(RunnableLock lock)
asyncExecback to summary
protected void asyncExec(Runnable runnable)

Causes the run() method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity. The caller of this method continues to run in parallel, and is not notified when the runnable has completed.

Parameters
runnable:Runnable

code to run on the user-interface thread.

See Also
syncExec
isMessagesEmptyback to summary
pack-priv boolean isMessagesEmpty()
moveAllEventsToback to summary
pack-priv void moveAllEventsTo(Synchronizer toReceiveTheEvents)

Removes all pending events from the receiver and inserts them into the beginning of the given synchronizer's queue

Parameters
toReceiveTheEvents:Synchronizer

the synchronizer that will receive the events

releaseSynchronizerback to summary
pack-priv void releaseSynchronizer()
removeFirstback to summary
pack-priv RunnableLock removeFirst()
runAsyncMessagesback to summary
pack-priv boolean runAsyncMessages()
runAsyncMessagesback to summary
pack-priv boolean runAsyncMessages(boolean all)
syncExecback to summary
protected void syncExec(Runnable runnable)

Causes the run() method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity. The thread which calls this method is suspended until the runnable completes.

Parameters
runnable:Runnable

code to run on the user-interface thread.

Exceptions
SWTException:
  • ERROR_FAILED_EXEC - if an exception occurred when executing the runnable
See Also
asyncExec