System.Classes.CheckSynchronize

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

extern DELPHI_PACKAGE bool __fastcall CheckSynchronize(int Timeout = 0x0);

Properties

Type Visibility Source Unit Parent
function public
System.Classes.pas
System.Classes.hpp
System.Classes System.Classes

Description

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

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.

See Also