Skip Menu |

This queue is for tickets about the subs-parallel CPAN distribution.

Report information
The Basics
Id: 22840
Status: rejected
Priority: 0/
Queue: subs-parallel

People
Owner: Nobody in particular
Requestors: mtomich [...] optusnet.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: question
Date: Mon, 6 Nov 2006 23:10:25 +1100
To: <bug-subs-parallel [...] rt.cpan.org>
From: "max" <mtomich [...] optusnet.com.au>
I have a question related to your statement : Also, there's no way to tell if a parallelized subroutine is still running or not. Maybe I didn't understand well but wouldn't be possible to do something like this : use subs::parallel;%arr={ 1,0, 2,0 };sub foo { my $me=$_[0]; # do stuff in a loop $arr{$me}=1; return 1 }; sub $bar{ my $me=$_[0]; # do stuff in a loop $arr{$me}=1; return 1}; parallelize_sub('foo');parallelize_sub('bar');foo(1);foo(2);while ( !($arr{'1'}) || !($arr{'2'}) ){ sleep 1; # check every second}print "Done 1 & 2\n"; Kind regards.Max.
This would only work if %arr was a shared variable (using threads::shared). In that case, yes, it would work. -Nilson On Mon Nov 06 07:10:11 2006, mtomich@optusnet.com.au wrote: Show quoted text
> I have a question related to your statement : > > Also, there's no way to tell if a parallelized subroutine is still > running or not. > > Maybe I didn't understand well but wouldn't be possible to do > something like this : > > > use subs::parallel;%arr={ 1,0, 2,0 };sub foo { > my $me=$_[0]; > # do stuff in a loop $arr{$me}=1; return 1 > }; > > sub $bar{ > my $me=$_[0]; > # do stuff in a loop $arr{$me}=1; return 1}; > parallelize_sub('foo');parallelize_sub('bar');foo(1);foo(2);while ( > !($arr{'1'}) || !($arr{'2'}) ){ sleep 1; # check every > second}print "Done 1 & 2\n"; > Kind regards.Max.