[fpc-pascal]Crashes with multithreading

Nico Erfurth masta at computerman.de
Tue Dec 12 01:02:08 CET 2000


>>> Shortly said: Yes. The only solution for this is to use separate
>>> streams in each thread, then it'll work fine.
>> The problem is, nothing in FPC is threadsafe, even the TThread-Class 
>> itself (InitThreads/DoneThreads).
>> The FPC-Team really needs to make the RTL and all other classes 
>> threadsafe. Its nearly impossible to trace errors in threaded applications.
> That is not entirely true; the Belgian national phone company collects data
> from their telephone stations using a multi-threaded Win32 application 
> written in FPC. 
> After changing the standard memory manager with the memory manager of 
> Windows itself the application runs very stable. It is just a matter
> of programming it right; there are some small parts that require some
> attention (such as file IO) but most of the RTL is thread-safe.
> The biggest problems are IOResult and the heap manager.
> Avoiding these two makes FPC apps pretty thread-safe.
> Which of course doesn't mean we won't work on thread-safety :-)
> Michael.

Sorry, i forget to say that i was talking about the Linux-version.
And i think, to provide a class named TThreadList and dont make it 
thread-safe is not very common ;)

The next problem in linux-version is the lack of 
Mutexes/Critical-Sections, which makes real threaded applications nearly 
impossible with FPC/Linux.

regards Nico Erfurth

P.S. Alltogether the FPC-Team is doing a good job, but maybe they 
shouldnt "Play around" so much and do some more work to make everything 
stable (on all plattforms).

More information about the fpc-pascal mailing list