comparison mercurial/lock.py @ 26356:927fa07a2ba4

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.
author Siddharth Agarwal <sid0@fb.com>
date Thu, 24 Sep 2015 15:57:11 -0700
parents db4c192cb9b3
children 6979a1369185
comparison
equal deleted inserted replaced
26355:f51713b8c6fa 26356:927fa07a2ba4
37 # new-style lock: symlink to hostname:pid 37 # new-style lock: symlink to hostname:pid
38 38
39 _host = None 39 _host = None
40 40
41 def __init__(self, vfs, file, timeout=-1, releasefn=None, acquirefn=None, 41 def __init__(self, vfs, file, timeout=-1, releasefn=None, acquirefn=None,
42 desc=None): 42 desc=None, parentlock=None):
43 self.vfs = vfs 43 self.vfs = vfs
44 self.f = file 44 self.f = file
45 self.held = 0 45 self.held = 0
46 self.timeout = timeout 46 self.timeout = timeout
47 self.releasefn = releasefn 47 self.releasefn = releasefn
48 self.acquirefn = acquirefn 48 self.acquirefn = acquirefn
49 self.desc = desc 49 self.desc = desc
50 self.parentlock = parentlock
51 self._parentheld = False
52 self._inherited = False
50 self.postrelease = [] 53 self.postrelease = []
51 self.pid = os.getpid() 54 self.pid = os.getpid()
52 self.delay = self.lock() 55 self.delay = self.lock()
53 if self.acquirefn: 56 if self.acquirefn:
54 self.acquirefn() 57 self.acquirefn()