[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Classes' (#rtl)

# CheckSynchronize

Check whether there are any synchronize calls in the synchronize queue.

## Declaration

Source position: classesh.inc line 2183

`function CheckSynchronize(`
`timeout: LongInt = 0`
`):Boolean;`

## Description

CheckSynchronize should be called regularly by the main application thread to handle any TThread.Synchronize calls that may be waiting for execution by the main thread. If any such calls are waiting for execution by the main thread, they are executed at once, in the order that they were scheduled.

The function returns True if any Synchronize method was executed.

TimeOut is the maximum amount of time (in milliseconds) that the CheckSynchronize routine will wait for synchronisation requests to appear in the queue.

Calling this routine more often will ensure that synchronize requests are handled faster.

This routine may not be called from any thread other than the main thread, as it will execute the waiting requests.

Threads may call the WakeMainThread to signal the main thread that the synchronisation queue contains items, and thus speed up the execution of the synchronize calls.

## See also

TThread.Synchronize |  | Synchronizes the thread by executing the method in the main thread.
WakeMainThread |  | Handler which is called if a thread wants to synchronize with the main application thread.