RAD Studio VCL Reference
Classes.CheckSynchronize Function

Allows background threads to synchronize their execution with the main thread.

function CheckSynchronize(Timeout: Integer = 0): Boolean;
Boolean CheckSynchronize(int Timeout = 0);

It is not necessary to call CheckSynchronize in a GUI application. The call to CheckSynchronize is made automatically by the application object. In a non-GUI application, you must call CheckSynchronize if you use the Synchronize method of TThread. To do this, set the WakeMainThread variable to a procedure that calls CheckSynchronize.  

CheckSynchronize allows background threads to synchronize their execution with the main thread, so that it is safe to make method calls in the background thread. 

CheckSynchronize returns True if a method was synchronized, False if it does nothing.

Warning: You should not modify WakeMainThread for GUI applications because a working handler has been assigned. Console applications may assign a handler to WakeMainThread if the application needs to be notified of a thread synchronization call. If your console application assigns a handler, this is an optimization that only accelerates deliver of notification that a synchronization request is available. You must use CheckSynchronize to perforrm the synchronization itself.


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!