What is the purpose of using TThread.Synchronize inside a AnonymousThread?

  

I came across this piece of Delphi code while searching for background methods to execute tasks in firemonkey.

TThread.CreateAnonymousThread(
procedure()
begin
Sleep(10000);
TThread.Synchronize(TThread.CurrentThread,
procedure
begin
Button2.Text := ‘OK’;
end);
end).Start;

Is TThread.Synchronize at this case really necessary?

Comments are closed.