![]() |
|
The stupid question is the question not asked | |
PerlMonks |
Re: Win32 ActiveState Perl 5.8 - use threadsby BrowserUk (Patriarch) |
on Jan 03, 2005 at 12:31 UTC ( #418926=note: print w/replies, xml ) | Need Help?? |
Whether it is possible to determine that thread is finished not using additional variables through threads::shared Yes, with a caveat. You cannot do anything else whilst you wait for it to complete.
join will wait for it's referrent thread to terminate. However, once you enter that wait state there is no way to regain control until the thread terminates, which means doing anything else whilst you wait is impossible and if the thread hangs, deadlocks or disappears up it's own bum in an endless loop, you can do nothing about it! This is one (of several) of the anacronisms of the POSIX pthreads API that Perl's iThreads emulate. For this reason, I always detach my threads (throwing away any return value and rendering the join API useless) and arrange my own mechanisms for detecting when a thread is finished. I'd prefer not have to do this "roll-my-own" adminstrative code, but the broken API makes it impossible to do otherwise and retain control Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
In Section
Seekers of Perl Wisdom
|
|