* Doh! The scope of $slotLock should extend to the end of the script,

because otherwise the lock will be released at the end of the while
  loop.
This commit is contained in:
Eelco Dolstra 2010-02-04 02:18:29 +00:00
parent c9b2d80bcd
commit 7ec5a65925

View file

@ -94,6 +94,7 @@ sub openSlotLock {
my $hostName; my $hostName;
my $slotLock;
while (1) { while (1) {
@ -164,7 +165,7 @@ while (1) {
my $selected = $available[0]; my $selected = $available[0];
my $machine = $selected->{machine}; my $machine = $selected->{machine};
my $slotLock = openSlotLock($machine, $selected->{free}); $slotLock = openSlotLock($machine, $selected->{free});
flock($slotLock, LOCK_EX | LOCK_NB) or die; flock($slotLock, LOCK_EX | LOCK_NB) or die;
utime undef, undef, $slotLock; utime undef, undef, $slotLock;