> Michael Kapelevich wrote:
> We are using Pth on freebsd.
> We are getting segmantation fault when calling ptherad_mutex_lock in signal
> handlers.
> This is the stack:
> #0 0x112ddf2d in __pth_ring_append(c0, 597340, 112e3060, 597334, 20, 5ab6f4,
> 112d7257, 597340)
> #1 0x112d9f90 in pth_mutex_acquire(597340, 0, 0, 1125c060, 734000, 5ab724,
> 11241b72, 597334)
> #2 0x112d7257 in pthread_mutex_lock(597334, 0, 0, 11241b5c, 1125c060, 0, 0, 0)
> #3 ...
> #4 ...
> #5 ...
>
> Is there a limitation on functions from pthreads in signal handlers ?
> Is there a way to reschedule the execution of the handlers to a more steady
> point in the program ?
In general you can do very little safely within a signal handler.
For example, malloc() is not allowed because FreeBSD's malloc()
is non reentrant. You can bet that pth does a lot of malloc's,
so you should avoid calling such routines within signal handlers.
Fortunately the answer is easy, use a PTH_EVENT_SIGNAL event or
pth_sigwait() to be notified synchronously of the signal and these
problems go away.
Semi-related, "ln -sf AJ /etc/malloc.conf" is a great help as well.
-Archie
__________________________________________________________________________
Archie Cobbs * Packet Design * http://www.packetdesign.com
______________________________________________________________________
GNU Portable Threads (Pth) http://www.gnu.org/software/pth/
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager (Majordomo) [EMAIL PROTECTED]