[fpc-pascal]Crashes with multithreading

Michael Van Canneyt michael.vancanneyt at wisa.be
Mon Dec 11 16:39:20 CET 2000


On Mon, 11 Dec 2000, Andrey Kubyshev wrote:

> Hello Jonas,
> 
> JM> FPC's heap manager and IO functions (writeln/readln) are *not* thread 
> JM> safe. That's probably what's causing the crashes. Add the cmem unit (from 
> JM> the "packages" units) as the first unit in your "uses" clause, then 
> JM> you're at least safe on the memory management side. You can't use heaptrc 
> JM> with it though.
> Thank you for such fast reply. But if IO operations not thread safe,
> does it means that all file operations also unsafe ?

Shortly said: Yes. The only solution for this is to use separate
streams in each thread, then it'll work fine.

Michael.





More information about the fpc-pascal mailing list