Next 1.3 More thread control methods Prev

More thread control methods

Getting the object for thread currently running:

my $this_thread = threads->self;

Getting the list of objects for all running and not detached threads:

my @threads = threads->list;

Getting the thread id (the main thread has tid=0):

my $tid = $thread->tid;

Comparing thread objects:

foreach (threads->list) { print $_->tid, "\n" unless threads::equal($_, threads->self); }

Next Perl Threads Prev