TIdSync and TIdNotify do not support anonymous procedures/functions, as it would be redundant because TThread.Synchronize() and TThread.Queue() themselves support anonymous procedures (and they have static overloads that do not require a TThread object, when you are working with non-RTL threads). For example:
procedure TMyThread.Execute;
begin
...
Synchronize(
procedure
begin
SomeFunction(Param1, Param2, Param2);
end
...
Queue(
procedure
begin
SomeFunction(Param1, Param2, Param2);
end
);
...
end;
// CreateThread() procedure
function MyThreadProc(pv: Pointer): DWORD; stdcall;
begin
...
TThread.Synchronize(nil,
procedure
begin
SomeFunction(Param1, Param2, Param2);
end
);
...
TThread.Queue(nil,
procedure
begin
SomeFunction(Param1, Param2, Param2);
end
);
...
Result := 0;
end;
TIdSync is just a wrapper for TThread.Synchronize() and TIdNotify is just a wrapper for TThread.Queue(). They were introduced in a time when all TThread had available was the non-static non-anonymous Synchronize() method. With the introduction of static methods and anonymous procedures into TThread, it now does just about everything that TIdSync and TIdNotify were designed to do, making them less relevant (but they still work, of course).