[fpc-devel] Threading in FPC and bug report

Florian Klaempfl florian at freepascal.org
Thu Jun 29 08:52:12 CEST 2006


Pedro Lopez-Cabanillas wrote:
> Hi,
> 
> I would like to ask politely for some elaboration about the closing comment on 
> this bug report: http://www.freepascal.org/mantis/view.php?id=5940
> 
> It was opened one year ago, when I was testing the FPC release 2.0.0, but the 
> situation didn't change too much in all this time. 
> 
> I know that it is not a real and perfect test case, but the program shows some  
> facts.
> 
> 1. When it is compiled with FPC under Linux, it behaves different than when 
> Kylix 3 is used. It doesn't need a thread.waitfor under Kylix to work 
> properly.

Multi threaded programs show often undeterministic behaviour and a slight
implementation difference makes ugly things like race conditions pop up.

> 2. The program exists with an ugly runtime error, when it is compiled with 
> FPC.

Yes, because imo the code contains a racing condition: under certain conditions,
the main thread might end and close all input/output handles etc. while the
thread executing MyThread.Execute might be still running. The code doesn't
ensure that the child thread exits before the main thread stops.





More information about the fpc-devel mailing list