in reply to Re: Suppressing thread warnings
in thread Suppressing thread warnings

For starters, one way to silence the warning (since threads 1.33?) is to detach the threads.

All very well if you *never* need to join the threads, but if, for example, you normally want to join them (to retrieve their results), but want to be able to terminate the process quickly without waiting for them if you receive a SIGTERM, you're stuffed.

You can't even use the costly and nearly useless $thr->kill( <SIG> ) mechanism to pass on the signal, because it won't interupt IO, sort, etc. So, you're forced to either:

These messages are entirely configurable and should be user controllable. Just another case of module authors deciding that they know better than module users.

If you wish to run your program in the background, ...

Where did that come from? Are you party to information not in the OP?


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^3: Suppressing thread warnings
by ikegami (Patriarch) on Oct 11, 2008 at 04:34 UTC

    All very well if you *never* need to join the threads, but if, for example, you normally want to join them (to retrieve their results), but want to be able to terminate the process quickly without waiting for them if you receive a SIGTERM, you're stuffed.

    My testing shows that exiting due to SIGTERM doesn't produce the warning. The process is simply killed. That means you can detach just before existing to silence the warning. Something like following should do the trick:

    END { $_->detach() for threads->list(); }

    If you wish to run your program in the background, ...

    Where did that come from? Are you party to information not in the OP?

    I got the idea that he wanted the threads to continue since he didn't end them. Obviously not the case. I should have provided assistance in ending his threads instead.

        Not a problem. Then the END block I posted handles it.