in reply to Re: multi-threaded questions
in thread multi-threaded questions
1. The "self->" in "threads->self->tid()" isn't needed (its an unfortunate meme many of us inherited from older threads docs).
2. If your intent is to kill the worker threads whenever any master thread detects an event, then you're fine.
However, I suspect you ultimately intend to keep those worker threads around to field queued events until the daemon is terminated. If my assumption is correct, then you've got a problem: queueing 30 msgs does not guarantee that all 30 threads will get a copy of the msg. It's entirely possible (indeed, quite probable) that the first few threads may get back to dequeueing before the last waiting threads get a chance to dequeue().
Which means you either have to
TQM provides a publish/subscribe capability, so that your master (as publisher) need only post a single msg to a single queue, and all worker threads (as subscribers) will get their own copy of the msg.
|
|---|