[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Threads and signals



Hi,

How do threads interact with signals? In particular, if I have a "main"
process thread (the one started by main()) which generates items for a
mutex-protected queue which are consumed by a worker thread, and I need
to insert an item in the queue from the signal handler, am I correct
that doing pthread_mutex_lock() from the signal handler could deadlock
if the signal handler is executed by any of the threads (and the mutex
is non-recursive)?

How is this solved in general? By recursive mutexes?

Attachment: signature.asc
Description: OpenPGP digital signature


Visit your host, monkey.org