line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ubic::Lockf::Alarm; |
2
|
|
|
|
|
|
|
$Ubic::Lockf::Alarm::VERSION = '1.60'; |
3
|
36
|
|
|
36
|
|
118
|
use strict; |
|
36
|
|
|
|
|
57
|
|
|
36
|
|
|
|
|
741
|
|
4
|
36
|
|
|
36
|
|
101
|
use warnings; |
|
36
|
|
|
|
|
21
|
|
|
36
|
|
|
|
|
3897
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: alarm guard |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new ($$) { |
9
|
0
|
|
|
0
|
1
|
|
my ($class, $timeout) = @_; |
10
|
0
|
|
|
|
|
|
bless { 'alarm' => alarm($timeout), 'time' => time }; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub DESTROY ($) { |
14
|
0
|
|
|
0
|
|
|
my $self = shift; |
15
|
0
|
|
|
|
|
|
local $@; |
16
|
0
|
|
|
|
|
|
my $alarm; |
17
|
0
|
0
|
|
|
|
|
if ($self->{alarm}) { |
18
|
0
|
|
|
|
|
|
$alarm = $self->{alarm} + $self->{time} - time; |
19
|
0
|
0
|
|
|
|
|
$alarm = 1 if $alarm <= 0; |
20
|
|
|
|
|
|
|
} else { |
21
|
0
|
|
|
|
|
|
$alarm = 0; |
22
|
|
|
|
|
|
|
} |
23
|
0
|
|
|
|
|
|
alarm($alarm); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |