Rob Springer wrote:
Hey all - I've noticed a problem when debugging some code, and it looks
to my eyes like there's a potential deadlock situation using the timed
LocalQueue::get() command when a fatal interrupt occurs.  I've posted
what I hope is clear reproducer code below.  Could someone else take a
quick look at it and tell me if I'm crazy or correct?

The api is in general not safe to call from a signal handler. While the mutexes are re-entrant, deadlocks around condition variables is very likely.

If you need to use interrupts, maybe the best solution is to have a 'signal queue' onto which notifications of signals are place, with a dedicated thread then processing that queue and invoking on the api to cleanup.

Of course that thread and the signal queue implementation will need to allow for the case where it is interrupted to actually handle the signal, but as that would be a more focused scope it would be easier than making the entire api interrupt safe.



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to