line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POSIX::RT::Semaphore; |
2
|
|
|
|
|
|
|
#============================================================================# |
3
|
|
|
|
|
|
|
|
4
|
16
|
|
|
16
|
|
611890
|
use 5.008; |
|
16
|
|
|
|
|
67
|
|
|
16
|
|
|
|
|
779
|
|
5
|
16
|
|
|
16
|
|
91
|
use strict; |
|
16
|
|
|
|
|
30
|
|
|
16
|
|
|
|
|
2378
|
|
6
|
|
|
|
|
|
|
our ($VERSION, @EXPORT_OK); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BEGIN { |
9
|
16
|
|
|
16
|
|
32
|
$VERSION = '0.05_02'; |
10
|
16
|
|
|
|
|
89
|
require XSLoader; |
11
|
16
|
|
|
|
|
23779
|
XSLoader::load(__PACKAGE__, $VERSION); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# -- awkwardness to support threaded |
14
|
|
|
|
|
|
|
# operation |
15
|
16
|
50
|
|
|
|
1224
|
if ($INC{'threads.pm'}) { |
16
|
0
|
|
|
|
|
0
|
require threads::shared; |
17
|
16
|
|
|
16
|
|
95
|
no warnings 'redefine'; |
|
16
|
|
|
|
|
34
|
|
|
16
|
|
|
|
|
819
|
|
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
0
|
for ('Unnamed::init', 'Named::open') { |
20
|
16
|
|
|
16
|
|
90
|
no strict 'refs'; |
|
16
|
|
|
|
|
27
|
|
|
16
|
|
|
|
|
2139
|
|
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
my $sym = __PACKAGE__ . "::$_"; |
23
|
0
|
|
|
|
|
0
|
my $ctor = \&{$sym}; |
|
0
|
|
|
|
|
0
|
|
24
|
0
|
|
|
|
|
0
|
*{$sym} = sub { |
25
|
0
|
|
|
|
|
0
|
my $psem = &$ctor; |
26
|
0
|
0
|
|
|
|
0
|
&threads::shared::share($psem) if defined $psem; |
27
|
0
|
|
|
|
|
0
|
$psem; |
28
|
|
|
|
|
|
|
} |
29
|
0
|
|
|
|
|
0
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
for ('Unnamed', 'Named') { |
32
|
16
|
|
|
16
|
|
93
|
no strict 'refs'; |
|
16
|
|
|
|
|
30
|
|
|
16
|
|
|
|
|
3275
|
|
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
my $sym = __PACKAGE__ . "::${_}::DESTROY"; |
35
|
0
|
|
|
|
|
0
|
my $dtor = \&{$sym}; |
|
0
|
|
|
|
|
0
|
|
36
|
0
|
|
|
|
|
0
|
*{$sym} = sub { |
37
|
0
|
|
|
|
|
0
|
lock($_[0]); |
38
|
0
|
0
|
|
|
|
0
|
return unless threads::shared::_refcnt($_[0]) == 1; |
39
|
0
|
|
|
|
|
0
|
&$dtor; |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
0
|
} |
42
|
|
|
|
|
|
|
} # -- if ($INC{'threads.pm'}) |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
16
|
|
|
16
|
|
112
|
use strict; |
|
16
|
|
|
|
|
45
|
|
|
16
|
|
|
|
|
512
|
|
47
|
16
|
|
|
16
|
|
85
|
use warnings; |
|
16
|
|
|
|
|
29
|
|
|
16
|
|
|
|
|
2561
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# |
50
|
|
|
|
|
|
|
# -- Internal methods |
51
|
|
|
|
|
|
|
# |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub import { |
54
|
22
|
|
|
22
|
|
2810
|
require Exporter; |
55
|
22
|
|
|
|
|
3672
|
goto &Exporter::import; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
# -- Public methods |
60
|
|
|
|
|
|
|
# |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub init { |
63
|
9
|
|
|
9
|
1
|
9250
|
shift @_; |
64
|
9
|
|
|
|
|
283
|
return POSIX::RT::Semaphore::Unnamed->init(@_); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub open { |
68
|
15
|
|
|
15
|
1
|
2647505
|
shift @_; |
69
|
15
|
|
|
|
|
2838
|
return POSIX::RT::Semaphore::Named->open(@_); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |