[fpc-pascal]Crashes with multithreading

Michael Van Canneyt michael.vancanneyt at wisa.be
Tue Dec 12 09:12:23 CET 2000


On Tue, 12 Dec 2000, Nico Erfurth wrote:

> Hi,
> 
> >>> 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.

We are aware of this, and we're looking at a cross-platform solution.

> 
> 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).

We will make it more stable,
but it must stay fun for us as well, so the 'playing around' is part
of the deal :-)

Michael.





More information about the fpc-pascal mailing list