Re: pthread issue.

From: Christopher Smith (x@xman.org)
Date: Wed May 24 2000 - 11:55:38 EST


On Mon, May 22, 2000 at 04:50:27PM -0700, George Anzinger wrote:
> Kip Matthew Macy wrote:
> > Read the man page again:
> >
> > <snip>
> >
> > ASYNC-SIGNAL SAFETY
> > The mutex functions are not async-signal safe. What this
> > means is that they should not be called from a signal han­
> > dler. In particular, calling pthread_mutex_lock or
> > pthread_mutex_unlock from a signal handler may deadlock
> > the calling thread.
> >
> > </snip>
> <snip>
>
> Gosh, is this common or just a Linux'ism? Seems like a real drag and
> not to easy to get around.

This is, in fact by POSIX definition. There is actually some logic to
it. Signal handlers are supposed to be very quick, and calls involving
mutex typically involve locking down all the CPU's on a system. For
all you know that could not be possible until whatever triggered the
signal finishes it's cleanup. If you actually need to do this you
probably should either a) be just altering a condition flag somewhere,
or b) use sigwait() or sigwaitinfo().

--Chris

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



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:11 EST