RE: fork and pthreads

From: Laramie Leavitt (laramie.leavitt@btinternet.com)
Date: Fri Mar 16 2001 - 18:11:14 EST


> Nitin Sane Wrote:
> > On Fri, Mar 16, 2001 at 06:52:26PM +0100, Richard Guenther wrote:
> > > Well, using pthreads and forking in them seems to trigger libc
> > > bugs (read: SIGSEGvs) here under certain conditions (happens,
> > > after I introduced signal handlers and using pthread_sigmask,
> > > I think), so hangs should be definitely possible, too...
> >
> > You must pretty much avoid using signal handlers with pthreads.
> > In stead, you need to carefully setup things such that most signals
> > are blocked in most threads and a single thread (or selected set
> > of threads) does a sigwait for signals of interest. Most good
> > pthreads books talk about this issue, as does the DCE documentation.
>
> I am not using any signals. All the signals are blocked with SIG_IGN
>

You know, I have been running into that exact same problem, except that
I don't fork at all. I start up my process and nearly immediately try
and spawn a few threads. The calling thread blocks indefinately in
a __sigsuspend(), but is apparently delivered an unknown signal.
The spawned thread executes normally.

It appears to be fixed when I compile with -D_REENTRANT, but I am not
certain...

Laramie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Mar 23 2001 - 21:00:09 EST