in reply to from pseudofork to threads
can i safely detach() inside the first foreach loop?use threads; my @kiddies; foreach(1..10) { print "$$ starting loop $_"; push @kiddies, threads->new(\&thisWasAnElse); print "$$ exiting loop $_"; } sub thisWasAnElse { print "\tchild ", threads->tid() " created ok"; sleep(int(rand(10))); print "\tchild", threads->tid() , " done, outta here"; } foreach @kiddies { $_->join(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: from pseudofork to threads
by pg (Canon) on Feb 02, 2003 at 18:18 UTC |