Show quoted text 7 lines
Hi everybody,
The manual (possibly Delphi one) says that TThread.OnTerminate executes
in the GUI thread. This is easy if the GUI thread owns the TThread.
Suppose the GUI owns a TTHread which owns a subthread. In which context
does the subthread's OnTerminate execute?
Under unix OnTerminate is always called in the main thread:
procedure TThread.CallOnTerminate;
begin
// no need to check if FOnTerminate nil, because
// thats already done in DoTerminate
FOnTerminate(self);
end;
procedure TThread.DoTerminate;
begin
if Assigned(FOnTerminate) then
Synchronize(@CallOnTerminate);
end;
Mattias