mrbear 发表于 2015-12-28 13:04:19

perl的线程(2)

  #!/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();
页: [1]
查看完整版本: perl的线程(2)