use threads; use threads::shared; $t1 = threads->create(\&__logger, '1'); $t2 = threads->create(\&__logger, '2'); $t1->join(); $t2->join(); print "the end\n"; sub __logger{ $id = shift; print "thread $id init\n"; $time = int(rand(10)); print "thread $id sleeping for $time\n"; sleep($time); print "thread $id ended\n"; }
In reply to Re: Perl threads
by Lennotoecom
in thread Perl threads
by Superfox il Volpone
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |