in reply to detached threads still warn

tried it out on the ancient linux box (perl 5.8.5)... and got the dreaded "A thread exited while 2 threads were running."

The warning is hardwired and can't be disabled. (I know. I railed, to no avail!) The reason you are seeing it on ancient Perl is because of a bug long since fixed.

Your choices are upgrade or live with it. It is only a warning.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: detached threads still warn
by pryrt (Abbot) on Oct 07, 2016 at 17:11 UTC

    I was hoping I could do something like installing a local version of threads.pm to distribute with my script... alas.

    Unfortunately, "upgrade perl" is not an option on that family of boxes (they were configured a decade ago for a particular purpose to work in a particular proprietary situation), and any tool I develop for those boxes must work within that framework. If threads ends up improving on my existing script (I don't even know if they will), I'll do a shell wrapper to grep -v that warning away. (My fellow users would complain every time they get a warning using my script.)

    Thanks hippo and BrowserUK... at least I know I'm not just doing something wrong.

      If the warning is meaningless as others have stated, you can catch all warnings by specifying a $SIG{__WARN__} handler, and prevent printing of that specific one:

      use warnings; use strict; $SIG{__WARN__} = sub { my $warn = shift; if ($warn !~ /^A thread exited/){ print $warn; } }; warn "blah blah warning\n"; warn "A thread exited...\n";

      Output:

      blah blah warning

      update: I just realized that the signal handler for warn does not appear to be re-entrant for a warn call from within the handler itself... that is, you can replace my print statement inside the handler with warn, and re-throw the actual warning:

      perl -E '$SIG{__WARN__}=sub{say "handler";warn $_[0] if $_[0]!~/^A thr +ead/}; warn "blah"; warn "A thread";' handler blah at -e line 1. handler

      /update