[Israel.pm] perl threads clarification

Issac Goldstand margol at beamartyr.net
Thu Dec 17 02:30:17 PST 2009


I've got a funny issue on tested on a bunch of platforms (linux, win32,
solaris 10), which seems to be showing perl ithreads who finish (and are
joinable) as both joinable and running.

I'm wondering why that would be, as they appear to me (based on
threads.pm's documentation) to be mutually exclusive, in that while
neither refer to joined or detached threads, the former should have
finished the entry routine and the latter should not be.

Is this a bug, or a simply me misreading something?

Here's some test code to illustrate the issue:
#!/usr/bin/perl

use threads;
local ($|) =1 ;
my $rv;
my $thr;
$thr = threads->create(sub {print "Hi!\n";});
sleep(1);
print "running " . threads::list(threads::joinable) ." " .
threads::list(threads::running) . "\n";
$thr->join;

Expected output:
Hi!
running 1 0

Got output:
Hi!
running 1 1



More information about the Perl mailing list