kzle has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
Recently I was in the middle of creating a script using threads, some problem come up, like the following:I read many entries about Perl threads, but not seeing any about create new thread inside the subroutine of another thread. Here's my question: Is there any possibility to create new thread within the referred subroutine of another thread?$master_thread = threads->create( \&sub1, $para ); .... .... sub sub1{ my $tmp = shift; ## not work as expected, I don't know why? my $sub_thread = threads->create( \&sub2, $tmp ); .... .... } sub sub2{ my $value = shift; print $value; }
Thanks
Yun
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: create new threads inside a thread
by ikegami (Patriarch) on Mar 26, 2010 at 06:36 UTC | |
by kzle (Novice) on Mar 26, 2010 at 07:09 UTC | |
by Anonymous Monk on Mar 26, 2010 at 07:16 UTC |