Commit 8057c833 authored by Leigh Stoller's avatar Leigh Stoller

Add TakeLock() so I can steal the lock away in the child after a fork.

parent 59d65359
......@@ -1510,6 +1510,22 @@ sub WaitLock($$;$)
return $self->Lock();
}
sub TakeLock($)
{
my ($self) = @_;
my $idx = $self->idx();
my $query_result =
DBQueryWarn("update project_leases set locked=now(),locker_pid=$PID " .
"where lease_idx=$idx");
return -1
if (!$query_result);
$self->{'LOCKED'} = time();
$self->{'LOCKER_PID'} = $PID;
return 0;
}
package Lease::Blockstore;
use base qw(Lease);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment