Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-06

Threading in FPC and bug report

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pedro Lopez-Cabanillas

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.
2. The program exists with an ugly runtime error, when it is compiled with FPC.
3. The program counts until 10 as it was intended when it is compiled under Kylix, not until eleven as with FPC.

Regards,
Pedro

Reply by email

Florian Klaempfl
to Pedro Lopez-Cabanillas
Pedro Lopez-Cabanillas wrote 14 lines
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.

Reply by email