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