Leser: 1
![]() |
![]() |
2 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/perl
###########
use threads;
use strict;
use warnings;
our $nthr = 4;
{
threads->new(\&sub1,"1");
threads->new(\&sub1,"2");
threads->new(\&sub1,"3");
threads->new(\&sub1,"4");
while($nthr > 0){}
}
sub sub1 {
my $id = shift;
our $nthr -= 1;
sleep(rand(10));
print "thread done. ($id,n=". $nthr .")\n";
}
![]() |
![]() |
2 Einträge, 1 Seite |