in reply to from pseudofork to threads
use threads; use strict; use constant NUMBER_OF_THREAD => 10; $|++; sub thread_job { print "I am a child, this is the name my parents gave me: ", shift +(), "\n"; } my @kids; for (1..NUMBER_OF_THREAD) { push @kids, threads->create(\&thread_job, $_); } foreach my $kid (@kids) { $kid->join(); } print "The family reunioned!";
|
|---|