Patchwork [2,of,5] lock: introduce state to keep track of inheritance

login
register
mail settings
Submitter Siddharth Agarwal
Date Sept. 24, 2015, 11:29 p.m.
Message ID <c7be83dfac5d81424808.1443137377@dev6666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/10619/
State Accepted
Headers show

Comments

Siddharth Agarwal - Sept. 24, 2015, 11:29 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1443135431 25200
#      Thu Sep 24 15:57:11 2015 -0700
# Node ID c7be83dfac5d81424808606823dfcc5a42048491
# Parent  ec07832637be1ee1e2cfc968db5e9d959b31032e
lock: introduce state to keep track of inheritance

This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances. In upcoming patches we will refer to this state.

Patch

diff --git a/mercurial/lock.py b/mercurial/lock.py
--- a/mercurial/lock.py
+++ b/mercurial/lock.py
@@ -39,7 +39,7 @@  class lock(object):
     _host = None
 
     def __init__(self, vfs, file, timeout=-1, releasefn=None, acquirefn=None,
-                 desc=None):
+                 desc=None, parentlock=None):
         self.vfs = vfs
         self.f = file
         self.held = 0
@@ -47,6 +47,9 @@  class lock(object):
         self.releasefn = releasefn
         self.acquirefn = acquirefn
         self.desc = desc
+        self.parentlock = parentlock
+        self._parentheld = False
+        self._inherited = False
         self.postrelease  = []
         self.pid = os.getpid()
         self.delay = self.lock()