[fpc-pascal] TThread and WaitFor

LacaK lacak at zoznam.sk
Fri May 6 11:33:48 CEST 2016


Hi *,
is this safe:

FThread.Terminate; // what if here is switched FThread to execution and 
will immediately end his Execute procedure
FThread.WaitFor; // what happens if FThread is freed before WaitFor is 
executed

?

assuming, that FThread has FreeOnTerminate := True;
(looking into source code it can IMO happen, that ThreadProc is ended 
and data allocated to FThread instance are freed thanks to FreeOnTerminate)

Is there any technique, when I need wait for thread to end execution and 
still have FreeOnTerminate = True ?

Thanks
-Laco.




More information about the fpc-pascal mailing list