[fpc-pascal] writeln: FPC runtime race conditions in external C threads

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Jul 12 22:58:43 CEST 2010

Alexander Grau wrote on Mon, 12 Jul 2010:

> Am 12.07.2010 um 22:31 schrieb Jonas Maebe:
>> I forgot to mention: before this works, you have to create at least  
>> one thread using the FPC RTL in order to initialise the threading  
>> subsystem. It can be terminated/freed immediately, see the test  
>> program that was committed together with the fix for an example.
> That did the trick!  Seems to work -  I'm really curious how this  
> works, since I assume there's probably no control over how the  
> external C thread is created and so no chance to initialize  
> something for the FPC runtime ...

The FPC runtime support for such a thread is initialised the first  
time you access a threadvar from that thread. And there's also a way  
to make libpthread automatically call a "destructor" routine when such  
a thread finishes (that's what I discovered today, and which was the  
missing piece of the puzzle).


This message was sent using IMP, the Internet Messaging Program.

More information about the fpc-pascal mailing list