Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
8057c833
Commit
8057c833
authored
Oct 28, 2014
by
Leigh B Stoller
Browse files
Add TakeLock() so I can steal the lock away in the child after a fork.
parent
59d65359
Changes
1
Hide whitespace changes
Inline
Side-by-side
db/Lease.pm.in
View file @
8057c833
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment