line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
;# $Id |
2
|
|
|
|
|
|
|
;# |
3
|
|
|
|
|
|
|
;# @COPYRIGHT@ |
4
|
|
|
|
|
|
|
;# |
5
|
|
|
|
|
|
|
;# $Log: Lock.pm,v $ |
6
|
|
|
|
|
|
|
;# Revision 0.3 2007/09/28 19:20:14 jv |
7
|
|
|
|
|
|
|
;# Track where lock was issued in the code. |
8
|
|
|
|
|
|
|
;# |
9
|
|
|
|
|
|
|
;# Revision 0.2.1.1 2000/01/04 21:16:28 ram |
10
|
|
|
|
|
|
|
;# patch1: track where lock was issued in the code |
11
|
|
|
|
|
|
|
;# |
12
|
|
|
|
|
|
|
;# Revision 0.2 1999/12/07 20:51:04 ram |
13
|
|
|
|
|
|
|
;# Baseline for 0.2 release. |
14
|
|
|
|
|
|
|
;# |
15
|
|
|
|
|
|
|
|
16
|
4
|
|
|
4
|
|
17
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
856
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
######################################################################## |
19
|
|
|
|
|
|
|
package LockFile::Lock; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
# A lock instance -- deferred class. |
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# ->_lock_init |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
# Common lock initialization |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
# Attributes: |
31
|
|
|
|
|
|
|
# |
32
|
|
|
|
|
|
|
# scheme the LockFile::* object that created the lock |
33
|
|
|
|
|
|
|
# filename where lock was taken |
34
|
|
|
|
|
|
|
# line line in filename where lock was taken |
35
|
|
|
|
|
|
|
# |
36
|
|
|
|
|
|
|
sub _lock_init { |
37
|
4
|
|
|
4
|
|
7
|
my $self = shift; |
38
|
4
|
|
|
|
|
7
|
my ($scheme, $filename, $line) = @_; |
39
|
4
|
|
|
|
|
17
|
$self->{'scheme'} = $scheme; |
40
|
4
|
|
|
|
|
16
|
$self->{'filename'} = $filename; |
41
|
4
|
|
|
|
|
19
|
$self->{'line'} = $line; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# |
45
|
|
|
|
|
|
|
# Common attribute access |
46
|
|
|
|
|
|
|
# |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
1
|
0
|
7
|
sub scheme { $_[0]->{'scheme'} } |
49
|
3
|
|
|
3
|
0
|
24
|
sub filename { $_[0]->{'filename'} } |
50
|
3
|
|
|
3
|
0
|
29
|
sub line { $_[0]->{'line'} } |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# |
53
|
|
|
|
|
|
|
# ->release |
54
|
|
|
|
|
|
|
# |
55
|
|
|
|
|
|
|
# Release the lock |
56
|
|
|
|
|
|
|
# |
57
|
|
|
|
|
|
|
sub release { |
58
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
59
|
1
|
|
|
|
|
46
|
return $self->scheme->release($self); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# |
63
|
|
|
|
|
|
|
# ->where |
64
|
|
|
|
|
|
|
# |
65
|
|
|
|
|
|
|
# Returns '"filename", line #' where lock was taken. |
66
|
|
|
|
|
|
|
# |
67
|
|
|
|
|
|
|
sub where { |
68
|
3
|
|
|
3
|
0
|
7
|
my $self = shift; |
69
|
3
|
|
|
|
|
27
|
return sprintf '"%s", line %d', $self->filename, $self->line; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|