threads in perl
From: Igor Ryaboy (igor.ryaboy_at_starcore-dsp.com)
Date: 01/13/04
- Next message: Wiggins D Anconia: "Re: Oreilly's "Learning Perl 3rd Edition""
- Previous message: Jan Eden: "Re: Problems with Text::Iconv"
- Next in thread: Zentara: "Re: threads in perl"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 13 Jan 2004 17:17:20 +0200 To: <beginners@perl.org>
Hi All!
I am running a multithread program and threads may stuck. I need to be able to terminate those threads after some defined period of time. I can't use a detach because I don't want to leave this thread run forever and I can't use join because the thread never ends. Any ideas? Please help :)
Igor
-----Original Message-----
From: zentara [mailto:zentara@highstream.net]
Sent: Monday, October 13, 2003 8:19 PM
To: beginners@perl.org
Subject: Re: FW: threads in perl
On Mon, 13 Oct 2003 18:29:09 +0200, igor.ryaboy@starcore-dsp.com (Igor
Ryaboy) wrote:
>Very Nice ,
>There is only one unsolved issue here: Your program may exit with other threads are
>still running , beside this I liked it very much. The actual solution you supplied is the
> use of threads->self function.
############################################
Yeah I fixed this.
>#cleanup leftover running threads
>print "data exhausted, waiting for threads to finish\n";
>threads->list()->join;
Replace the above with:
#cleanup leftover running threads
print "data exhausted, waiting for threads to finish\n";
while (1){
@running_threads = threads->list;
if (scalar(@running_threads) < 1){print "\nFinished\n";exit}else{next}
}
#################################################
>Thanks you very much!!!
Your welcome, it was a learning experience for me too. :-)
>Igor
>BTW where can I get some documentation about threads::Pool?
Download the module from cpan. But I just checked out the latest
version of Threads::Pool and it only works with perl5.8.0-RC3 or
later. I installed 5.81 to test it, but 5.81 broke some other modules
I'm playing with. So.....it's up to you.
Our body's 20 milligrams of beta radioactive Potassium 40
emit about 340 million neutrinos per day, which go at
lightspeed to the ends of the universe!..even thru the earth.
-- To unsubscribe, e-mail: beginners-unsubscribe@perl.org For additional commands, e-mail: beginners-help@perl.org
- Next message: Wiggins D Anconia: "Re: Oreilly's "Learning Perl 3rd Edition""
- Previous message: Jan Eden: "Re: Problems with Text::Iconv"
- Next in thread: Zentara: "Re: threads in perl"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]