Again, as your intentions are less than clear, I'm "assuming" intent.

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.


Perl Contrarian & SQL fanboy

In reply to Re^2: multi-threaded questions by renodino
in thread multi-threaded questions by btoovey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.