perl的线程(2)

来源:互联网 时间:1970-01-01

#!/usr/bin/perl
#
use threads;

sub say_hello {
  printf("Hello thread! @_./n");
  sleep(10);
  printf("Bye/n");
}

 sub quick_exit {
printf("I will be exit in no time/n");
exit(1);
}

my $t1 = threads->create( /&say_hello, "param1", "param2" );
my $t2 = threads->create( {'exit'=>'thread_only'}, /&quick_exit );

$t1->join();
$t2->join();


相关阅读:
Top