mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 11:00:15 +02:00
The documentation says that a "BeginThread" needs to be followed by a "CloseThread". The implementation of TThread did not respect this yet.
Note: The only RTL where this could lead to problems is for BeOS with the old threading implementation as this does not use "BeginThread" at all (the newer implementation does). rtl/objpas/classes/classes.inc, TThread.Destroy: * call "CloseThread" if the thread handle is valid (mimics the logic of the Windows RTL) rtl/win/tthread.inc, TThread.SysDestroy: * remove the call to "CloseHandle"; this is done by "CloseThread" afterwards git-svn-id: trunk@24313 -
This commit is contained in:
parent
6c1ea83c5a
commit
bd7cc36ea6
rtl
@ -191,8 +191,11 @@ end;
|
||||
|
||||
destructor TThread.Destroy;
|
||||
begin
|
||||
if not FExternalThread then
|
||||
if not FExternalThread then begin
|
||||
SysDestroy;
|
||||
if FHandle <> TThreadID(0) then
|
||||
CloseThread(FHandle);
|
||||
end;
|
||||
RemoveQueuedEvents(Self);
|
||||
DoneSynchronizeEvent;
|
||||
{ set CurrentThreadVar to Nil? }
|
||||
|
@ -32,7 +32,6 @@ begin
|
||||
Start;
|
||||
WaitFor;
|
||||
end;
|
||||
CloseHandle(FHandle);
|
||||
end;
|
||||
|
||||
FFatalException.Free;
|
||||
|
Loading…
Reference in New Issue
Block a user