Closed rlebeau closed 7 years ago
Implemented in SVN rev 5429.
TIdNotify
now supports TThread.ForceQueue()
in RAD Studio 10.2 Tokyo and later, and also TThread.Queue()
in FreePascal 3.0 and later.
TIdNotify.Notify()
now respects the MainThreadUsesNotify
property once again. When called in the main thread, if MainThreadUsesNotify
is true and TThread.ForceQueue()
is not available, Notify()
creates an internal worker thread (TIdNotifyThread
) to queue the notification. Just like it used to before support for TThread.Queue()
was first added.
TIdNotifyThread
now uses TThread.Queue()
when available, instead of using TThread.Synchronize()
.
An optional AForceQueue
parameter has been added to TIdNotify.NotifyMethod()
.
RAD Studio 10.2 Tokyo added a new
TThread.ForceQueue()
method for RSP-15427, allowing code in the main UI thread to queue a method for delayed execution, whereasTThread.Queue()
executes it immediately.TIdNotify
used to have this same feature years ago. WhenTIdNotify.Notify()
was invoked by the main UI thread, andTIdNotify.MainThreadUsesNotify
was True,Notify()
would spawn a worker thread to queue the notification to the main UI thread. That functionality was lost (but not the property itself) whenTIdNotify.Notify()
was updated to stop using the worker thread and instead useTThread.Queue()
in Delphi/C++Builder 8+.With
TThread.ForceQueue()
,TIdNotify.Notify()
andTIdNotify.NotifyMethod()
can regain the ability to queue methods when invoked by the main UI thread andMainThreadUsesNotify
is True, without having to spawn a worker thread to do it (for Delphi/C++Builder 7 and earlier, and FreePascal, the worker thread will still be needed).