WakeMainThread
Handler which is called if a thread wants to synchronize with the main application thread.
Declaration
Source position: classesh.inc line 2343
var
WakeMainThread : TNotifyEvent = Nil;
Description
WakeMainThread is a handler, which, when set, is called by the TThread.Synchronize routine to signal the main thread that a synchronization routine is waiting in the queue.
This handler is by default empty. An actual implementation depends on the main program logic (usually an event loop) and must be provided by the event loop logic: the event loop will normally call CheckSynchronize at regular intervals. The WakeMainThread can make sure this happens as soon as possible.
While this handle should alert the main program thread that a thread is waiting for synchronization, the call is executed by the thread, and should therefore NOT synchronize the thread, but should somehow signal the main thread that a thread is waiting for synchronization. For example, by sending a message.
See also
Name | Description |
---|---|
CheckSynchronize | Check whether there are any synchronize calls in the synchronize queue. |
TNotifyEvent | Standard event handler type. |
TThread.Synchronize | Synchronizes the thread by executing the method in the main thread. |