It is possible Multiple threads share the same OnTerminate Event
Yes, just as the answer to the other question showed you.
and finish at the same time?
The threads may finish their work at the same time, but by default the OnTerminate
event handler(s) will not be called at the same time. This is because the OnTerminate
event handler is triggered by TThread
using an internal call to TThread.Synchronize()
, so multiple threads triggering their OnTerminate
events at the same time will not overlap each other. To change that behavior (which most people do not do), you would have to override the virtual TThread.DoTerminate()
method to manually call the OnTerminate
event handler directly without calling TThread.Synchronize()
first.