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';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Monitor list of threads running
by mr_p (Scribe) on Apr 08, 2010 at 19:54 UTC | |
by BrowserUk (Patriarch) on Apr 08, 2010 at 20:01 UTC | |
by mr_p (Scribe) on Apr 08, 2010 at 20:04 UTC | |
by Corion (Patriarch) on Apr 08, 2010 at 20:09 UTC | |
by mr_p (Scribe) on Apr 08, 2010 at 20:17 UTC | |
|