monitoring a detached thread

[email protected] (Tom Brettin)
Newsgroups perl.ithreads
Message-ID <[email protected]>
I want to have a model where the boss sends the worker off to do some work. 
The worker does not need to communicate the results back to the boss. 
Meanwhile, the boss needs to report that the worker is working at regular 
intervals until the worker is done.

    my $thread = threads->create(\&workerThread);
    my $tid = $thread->tid;
    $thread->detach();
    
    while(1) {
	print "worker thread $tid is busy\n";
	sleep 3;
	last unless threads->object($tid);
    }

The problem that I'm having is that the while loop never terminates. I 
thought that once the worker was done, the call to threads->object($tid) 
would return undef.

How can the boss monitor the worker?

Thanks for any help.
Tom
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.