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