[fpc-devel] threads crash on FreeBSD 9 RC1, FPC 2.6RC1

Sergei Gorelkin sergei_gorelkin at mail.ru
Wed Nov 9 23:13:53 CET 2011


09.11.2011 22:58, Helmut Hartl пишет:
>
> My (quick) deduction from the output below was that somewhow the initialisation of the memory
> managment for the new thread gone bad, as the crash seems to be in the new thread.
> Hence I changed the memorymanager to cmem and the problem goes away, now our
> software works and passes it's testsuites.
>
Unfortunately there is a major flaw in thread initialization sequence: using memory manager before 
it is initialized. E.g. in rtl/unix/cthreads.pp, around line 280 there is the following code:

    ti:=pthreadinfo(param)^;
    dispose(pthreadinfo(param));        <- memory manager used
    { Initialize thread }
    InitThread(ti.stklen);              <- memory manager initialized (among other stuff)
    { Start thread function }

This applies to all targets except Windows (which I fixed in rev.17938). How it happened to work 
without crashing until now, I don't know. I also won't claim that it *is* the reason of crash in 
your program, but it may be a reason.

Regards,
Sergei



More information about the fpc-devel mailing list