* fixed FFreeOnTerminate handing in destructor + better comments

git-svn-id: trunk@7617 -
This commit is contained in:
Jonas Maebe 2007-06-09 20:36:35 +00:00
parent 51ebaa592f
commit e93d612f4a

View File

@ -172,9 +172,6 @@ begin
inherited destroy;
exit;
end;
// if someone calls .Free on a thread with
// FreeOnTerminate, then don't crash!
FFreeOnTerminate := false;
if (FThreadID = GetCurrentThreadID) then
begin
if not(FFreeOnTerminate) and not FFinished then
@ -183,6 +180,11 @@ begin
end
else
begin
// if someone calls .Free on a thread with not(FreeOnTerminate), there
// is no problem. Otherwise, FreeOnTerminate must be set to false so
// when ThreadFunc exits the main runloop, it does try to Free itself
// again
FFreeOnTerminate := false;
{ you can't join yourself, so only for FThreadID<>GetCurrentThreadID }
{ and you can't join twice -> make sure we didn't join already }
if not FThreadReaped then