
David Greene
That'll probably work, given that you use a single mutex to protect scheduler & machine. However, this is rather ugly as you end up locking two mutextes whenever you queue an event.
Does this imply that there's a mutex in state_machine somewhere that gets locked on some operations? That could definitely be problematic and I'll have to take extra care to avoid deadlock.
No, state_machine is not thread-safe and non-reentrant. It does not make any calls to synchronization primitives. IIRC, the only functions that make such calls are fifo_worker::terminate, fifo_worker::queue_work_item, fifo_worker::operator(). So, AFAICS, deadlock should not be an issue. Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.