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

Michael Van Canneyt michael at freepascal.org
Mon Jul 12 13:43:04 CEST 2010



On Mon, 12 Jul 2010, Alexander Grau wrote:

>
> Am 12.07.2010 um 13:24 schrieb Michael Van Canneyt:
>
>> 
>> 
>> Basically, any heap memory access and standard pascal I/O are forbidden in
>> threads started outside FPC, because the necessary thread structures are 
>> not
>> initialized correctly.
>
> Is my assumption correct that this means I cannot use much of FPC then?  As 
> far as I can see, calling an object seems to be possible without any crash 
> (aren't these on the heap too ?).

Class instances are allocated  on the heap, yes. And strings as well.

>
> Due to these limitations, I think the best then would be to switch from the C 
> callback thread into the FPC thread - how would that be (safely) possible?

I haven't found a way to do this. I would love to, since it would mean that
Apache modules would also work with apache thread workers.

Michael.



More information about the fpc-pascal mailing list