System.Classes.TThread.StaticSynchronize

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class procedure StaticSynchronize(const AThread: TThread; AMethod: TThreadMethod); static; deprecated 'From C++ just use Synchronize now that it is just a static method';

C++

static void __fastcall StaticSynchronize _DEPRECATED_ATTRIBUTE1("From C++ just use Synchronize now that it is just a static method") (TThread* const AThread, TThreadMethod AMethod);

Properties

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

Description

Warning: StaticSynchronize is deprecated. Please use Synchronize.

Executes a method call within the main thread.

StaticSynchronize causes the call specified by AMethod to be executed using the main thread, thereby avoiding multi-thread conflicts. The current thread is passed in the AThread parameter.

If you are unsure whether a method call is thread-safe, call it from within the StaticSynchronize method to ensure that it executes in the main thread.

Execution of the current thread is suspended while Method executes in the main thread.

Warning: Do not call StaticSynchronize from within the main thread. This can cause an infinite loop.

Note: StaticSynchronize simply invokes Synchronize with the same parameters.

Note: You can also protect unsafe methods using critical sections or the multi-read exclusive-write synchronizer.

See Also