A clearer description of the "tasks" in question, the communications requirements etc. would make it easier to make suggestions.

Threads would be in randomly failing department, additionally there are way to many flavors, each with it's own set of problems, advantages and disadvantages.

If we're talking Perl, there are only two flavours and only one of them is worth considering.

It's not hard to arrange for threads to operate cooperatively--it's quite simple actually--but, in common with all forms of cooperative multitasking, you need to embed yeild points within the loops. If you are able to do this, then you could equally embed return unless $timeleft; at those same points and bottle out when the time has expired and move onto the next task.

You seem to be hooked on telling us how Perl cannot help you, rather than helping us tell you how it could.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.
Rule 1 has a caveat! -- Who broke the cabal?

In reply to Re^5: Splitting one large timeout into few smaller ones.. by BrowserUk
in thread Splitting one large timeout into few smaller ones.. by Eyck

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.