[fpc-pascal] Where is IsMultiThreaded set under Linux?

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Oct 8 15:13:40 CEST 2010


On 08 Oct 2010, at 14:52, Graeme Geldenhuys wrote:

> I thought about the timeout, and dived into the WaitFor code. So I
> changed my code from.
>
>    FThread.WaitFor;
>
> ..to...
>
>    WaitForThreadTerminate(FThread.Handle, 2000);


The timeout parameter is ignored when using cthreads, because the  
pthreads API does not support waiting for a thread termination with a  
timeout.

Furthermore, the whole point of WaitFor() is to block the current  
execution thread from continuing until the thread has finished (it's a  
synchronisation point). If you just want to quickly check whether the  
thread has finished, check FThread.Finished (followed by  
FThread.Waitfor to clean it up in case it's true).


Jonas



More information about the fpc-pascal mailing list