in reply to Re^2: Monitor list of threads running
in thread Monitor list of threads running

It does not do anything with $thr.

Exactly. You are throwing it (them, one for each thread you create) away. So don't do that, save them.

my @threads; for (0 ..3)) { my $thr = threads->create( sub { worker(); } ); $thr->detach(); push @threads, $thr; } ... # then later for my $thr ( @threads ) { print 'Thread ', $thr->tid, $thr->is_running ? ' is running' : ' is not running';

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.
"I'd rather go naked than blow up my ass"

Replies are listed 'Best First'.
Re^4: Monitor list of threads running
by mr_p (Scribe) on Apr 08, 2010 at 19:54 UTC
    I did something similar: and I get this message. <bolckquote> Can't locate auto/threads/is_running.al in...
    foreach my $test (@all_threads) { if( $test->is_running() ) { print "Running: $test\n"; } }

      Which version of threads are you using?

        usethreads=define use5005threads=undef useithreads=define