Re: How to check if a thread is alive?

[email protected] (Mike Pomraning)
Newsgroups perl.ithreads
Message-ID <[email protected]>
On Tue, 18 Nov 2003, EastInspection USA wrote:

> It seems to me it is a bug in ithread. If a thread dies, then
> ithread->list() should not list it as an alive thread.

This is a documentation ambiguity, not a bug in ithreads.  :-)  Some of the
threads documentation is drawn from previous implementations, and is a little
dusty here and there.  The L<threads> documentation states more precisely that

  threads->list();
      This will return a list of all non joined, non detached threads.
  [http://www.perldoc.com/perl5.8.0/lib/threads.html]

A non-detached thread that has finished its entry point routine, perhaps by
die()ing, is still joinable.  This is somewhat analogous to wait()ing for a
terminated process (at least on POSIXy systems).

So, threads->list lists joinable threads; take a look at Liz's Thread::Running
to find out whether your threads are still in their entry point routines.

Regards,
Mike
-- 
Michael J. Pomraning
[email protected]
http://pilcrow.madison.wi.us
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.