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:
$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; }
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?

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
      Yes, ikegami, I think its the same problem, any idea how to avoid this?

      thanks,

      Yun