line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package KinoSearch1::Store::RAMLock; |
2
|
38
|
|
|
38
|
|
2312
|
use strict; |
|
38
|
|
|
|
|
70
|
|
|
38
|
|
|
|
|
1379
|
|
3
|
38
|
|
|
38
|
|
210
|
use warnings; |
|
38
|
|
|
|
|
71
|
|
|
38
|
|
|
|
|
943
|
|
4
|
38
|
|
|
38
|
|
279
|
use KinoSearch1::Util::ToolSet; |
|
38
|
|
|
|
|
71
|
|
|
38
|
|
|
|
|
5393
|
|
5
|
38
|
|
|
38
|
|
218
|
use base qw( KinoSearch1::Store::Lock ); |
|
38
|
|
|
|
|
72
|
|
|
38
|
|
|
|
|
5746
|
|
6
|
|
|
|
|
|
|
|
7
|
38
|
|
|
38
|
|
462
|
BEGIN { __PACKAGE__->init_instance_vars() } |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub do_obtain { |
10
|
190
|
|
|
190
|
0
|
303
|
my $self = shift; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# bail if the virtual lockfile already exists |
13
|
190
|
100
|
|
|
|
774
|
return if $self->{invindex}->file_exists( $self->{lock_name} ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# create a virtual lockfile |
16
|
189
|
|
|
|
|
799
|
my $temp = $self->{invindex}->open_outstream( $self->{lock_name} ); |
17
|
189
|
|
|
|
|
1196
|
$temp->close; |
18
|
189
|
|
|
|
|
1297
|
return 1; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub release { |
22
|
189
|
|
|
189
|
0
|
313
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# delete the virtual lockfile |
25
|
189
|
|
|
|
|
709
|
$self->{invindex}->delete_file( $self->{lock_name} ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub is_locked { |
29
|
190
|
|
|
190
|
0
|
1088
|
my $self = shift; |
30
|
190
|
|
|
|
|
769
|
return $self->{invindex}->file_exists( $self->{lock_name} ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |