悲剧,绝对的悲剧,悲剧中的悲剧。
分类:
2011-04-01 09:48:24
#!/usr/bin/perl -w
use threads ;
use threads::shared;my %h = (
’1′=>’a',
’2′=>’b',
’3′=>’c',
);&main(\%h);
sub main {
my ($in) = @_;
foreach my $i (0..4){
threads->new ( \&sub_func, $in );
}threads->list()->join();
}
sub sub_func{
my ($arg1) = @_;
print “$arg1->{1} —”;
print threads->self->tid;
print “\n”;
}