projects
/
p5sagit/p5-mst-13.2.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Fix bad assumptions in test case.
[p5sagit/p5-mst-13.2.git]
/
ext
/
threads
/
shared
/
t
/
cond.t
1
BEGIN {
2
chdir 't' if -d 't';
3
push @INC ,'../lib';
4
require Config; import Config;
5
unless ($Config{'useithreads'}) {
6
print "1..0 # Skip: no threads\n";
7
exit 0;
8
}
9
}
10
$|++;
11
print "1..5\n";
12
use strict;
13
14
15
use threads;
16
17
use threads::shared;
18
19
my $lock : shared;
20
21
sub foo {
22
lock($lock);
23
print "ok 1\n";
24
sleep 2;
25
print "ok 2\n";
26
cond_wait($lock);
27
print "ok 5\n";
28
}
29
30
sub bar {
31
lock($lock);
32
print "ok 3\n";
33
cond_signal($lock);
34
print "ok 4\n";
35
}
36
37
my $tr = threads->create(\&foo);
38
my $tr2 = threads->create(\&bar);
39
$tr->join();
40
$tr2->join();
41