blob: 92dacec014eaf5d605b1da3e6a8182576ea7a2ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
use strict;
use warnings;
use Test::More 'tests' => 7;
use Thread::Semaphore;
my $s = Thread::Semaphore->new();
is($$s, 1, 'Non-threaded semaphore');
$s->down();
is($$s, 0, 'Non-threaded semaphore');
$s->up(2);
is($$s, 2, 'Non-threaded semaphore');
$s->down();
is($$s, 1, 'Non-threaded semaphore');
ok(! $s->down_nb(2), 'Non-threaded semaphore');
ok($s->down_nb(), 'Non-threaded semaphore');
ok(! $s->down_timed(1), 'Non-threaded semaphore');
exit(0);
# EOF
|