[fpc-pascal] TThread.FreeOnTerminate

Jonas Maebe jonas at freepascal.org
Fri Dec 14 18:08:35 CET 2018


On 14/12/18 11:09, Luca Olivetti wrote:
> 
> I think that TThread should have a method to kill it for such cases, 
> using, e.g., pthread_cancel under unix

pthread_cancel() does not not kill a thread. Conceptually, it is exactly 
the same as calling TThread.terminate: it just sets a property for the 
thread to indicate someone wants it to stop. The thread will only stop 
the next time pthread_testcancel() gets subseaquently called from inside 
this "cancelled" thread, which should only be done at well-defined 
points so the chances at leaving stray locks etc behind are minimalised.


Jonas



More information about the fpc-pascal mailing list