7 |
/]; |
/]; |
8 |
## If you are locking for Graph, then you cannot lock for Global, but |
## If you are locking for Graph, then you cannot lock for Global, but |
9 |
## still you can lock for ID. |
## still you can lock for ID. |
10 |
|
## |
11 |
|
## In addition, if you are locking for an ID, then you can't lock |
12 |
|
## for another ID. |
13 |
|
## |
14 |
|
## XXX Maybe we should get rid of IDs and Name locks because they |
15 |
|
## conflict with ID and Names locks respectively. Additionally, |
16 |
|
## maybe we should remove Global lock as well. |
17 |
|
|
18 |
## idgen is currently controled by Names lock. |
## idgen is currently controled by Names lock. |
19 |
|
|
40 |
|
|
41 |
my $self_lt = $self->lock_type; |
my $self_lt = $self->lock_type; |
42 |
for my $lt (@$LockTypes) { |
for my $lt (@$LockTypes) { |
43 |
if ($self_lt eq $lt) { |
if ($CurrentlyLocking->{$lt}) { |
|
last; |
|
|
} elsif ($CurrentlyLocking->{$lt}) { |
|
44 |
die qq[$0: It is currently locking for "$lt" so that it cannot be locked for the "$self_lt"]; |
die qq[$0: It is currently locking for "$lt" so that it cannot be locked for the "$self_lt"]; |
45 |
|
} elsif ($self_lt eq $lt) { |
46 |
|
last; |
47 |
} |
} |
48 |
} |
} |
49 |
|
|
55 |
|
|
56 |
$self->check_lockability; |
$self->check_lockability; |
57 |
$CurrentlyLocking->{$self->lock_type}++; |
$CurrentlyLocking->{$self->lock_type}++; |
58 |
warn "@{[$self->lock_type]} $CurrentlyLocking->{$self->lock_type} $self->{file_name}"; |
|
59 |
|
warn "XXX @{[$self->lock_type]} $CurrentlyLocking->{$self->lock_type} $self->{file_name}"; |
60 |
|
|
61 |
open my $file, '>', $self->{file_name} or die "$0: $self->{file_name}: $!"; |
open my $file, '>', $self->{file_name} or die "$0: $self->{file_name}: $!"; |
62 |
flock $file, LOCK_EX; |
flock $file, LOCK_EX; |