in reply to Perl Threads

Take a look at threads Signalling and the threads->kill() function in the latest versions of threads.

I haven't had occasion to use it yet, but it seems to be tailor-made for your application and should work everywhere threads do. Ie. even on Win32.

Update: The limitations of this feature pointed out by tye mean that it is probably not useful for your application.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: Perl Threads (cooperative)
by tye (Sage) on Nov 07, 2007 at 03:41 UTC

    Note that the documentation notes the following:

    For instance, if the thread is stuck on an I/O call, sending it a signal will not cause the I/O call to be interrupted such that the signal is acted up[on] immediately.

    Which may make these rather useless for this specific task.

    - tye        

      Which may make these rather useless for this specific task.

      Indeed++. I had not notice that (rather important) limitation tucked away down there at the end of the section. (Did mention I hadn't had occasion to use this yet :)

      That really ought to be somewhere nearer the top, like maybe the second sentence.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.