threads/76690: fork hang in child for (-lc_r & -lthr)

Daniel Eischen deischen at freebsd.org
Mon Oct 24 09:41:04 PDT 2005


On Mon, 24 Oct 2005, Sven Berkvens-Matthijsse wrote:
> > It may even be enough just to set __isthreaded to 0 in the child
> > after the fork() before calling any malloc()'s and free()'s so they
> > don't try to use the lock.
>
> But then the free() in the child process may be using an unstable
> state of the malloc system (because if you don't acquire the lock
> before the fork(), malloc() may be busy in the middle of the fork()).

I don't think that can happen because libc_r will not switch out
a thread that is in a critical region (and libc locks are critical
regions) until it leaves the region.

-- 
DE



More information about the freebsd-threads mailing list