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

Daniel Eischen deischen at freebsd.org
Tue Oct 25 05:52:18 PDT 2005


On Tue, 25 Oct 2005, Sven Berkvens-Matthijsse wrote:

> > > 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.
>
> What code leads you to that conclusion? All the malloc functions

I had thought that spinlocks and internal mutexes (_pthread_mutex_lock()
called from libc) would mark critical regions.  That was the intent,
but it doesn't seem to be implemented that way in libc_r.  It _is_
implemented that way in libpthread.

-- 
DE



More information about the freebsd-threads mailing list