##// END OF EJS Templates
lock: add internal config to not replace signal handlers while locking...
Yuya Nishihara -
r38157:8c828beb stable
parent child Browse files
Show More
@@ -1127,6 +1127,9 b" coreconfigitem('ui', 'report_untrusted',"
1127 coreconfigitem('ui', 'rollback',
1127 coreconfigitem('ui', 'rollback',
1128 default=True,
1128 default=True,
1129 )
1129 )
1130 coreconfigitem('ui', 'signal-safe-lock',
1131 default=True,
1132 )
1130 coreconfigitem('ui', 'slash',
1133 coreconfigitem('ui', 'slash',
1131 default=False,
1134 default=False,
1132 )
1135 )
@@ -1693,12 +1693,15 b' class localrepository(object):'
1693 if wait:
1693 if wait:
1694 timeout = self.ui.configint("ui", "timeout")
1694 timeout = self.ui.configint("ui", "timeout")
1695 warntimeout = self.ui.configint("ui", "timeout.warn")
1695 warntimeout = self.ui.configint("ui", "timeout.warn")
1696 # internal config: ui.signal-safe-lock
1697 signalsafe = self.ui.configbool('ui', 'signal-safe-lock')
1696
1698
1697 l = lockmod.trylock(self.ui, vfs, lockname, timeout, warntimeout,
1699 l = lockmod.trylock(self.ui, vfs, lockname, timeout, warntimeout,
1698 releasefn=releasefn,
1700 releasefn=releasefn,
1699 acquirefn=acquirefn, desc=desc,
1701 acquirefn=acquirefn, desc=desc,
1700 inheritchecker=inheritchecker,
1702 inheritchecker=inheritchecker,
1701 parentlock=parentlock)
1703 parentlock=parentlock,
1704 signalsafe=signalsafe)
1702 return l
1705 return l
1703
1706
1704 def _afterlock(self, callback):
1707 def _afterlock(self, callback):
@@ -21,6 +21,7 b' from . import ('
21 encoding,
21 encoding,
22 error,
22 error,
23 pycompat,
23 pycompat,
24 util,
24 )
25 )
25
26
26 from .utils import (
27 from .utils import (
@@ -177,7 +178,7 b' class lock(object):'
177
178
178 def __init__(self, vfs, fname, timeout=-1, releasefn=None, acquirefn=None,
179 def __init__(self, vfs, fname, timeout=-1, releasefn=None, acquirefn=None,
179 desc=None, inheritchecker=None, parentlock=None,
180 desc=None, inheritchecker=None, parentlock=None,
180 dolock=True):
181 signalsafe=True, dolock=True):
181 self.vfs = vfs
182 self.vfs = vfs
182 self.f = fname
183 self.f = fname
183 self.held = 0
184 self.held = 0
@@ -189,6 +190,10 b' class lock(object):'
189 self.parentlock = parentlock
190 self.parentlock = parentlock
190 self._parentheld = False
191 self._parentheld = False
191 self._inherited = False
192 self._inherited = False
193 if signalsafe:
194 self._maybedelayedinterrupt = _delayedinterrupt
195 else:
196 self._maybedelayedinterrupt = util.nullcontextmanager
192 self.postrelease = []
197 self.postrelease = []
193 self.pid = self._getpid()
198 self.pid = self._getpid()
194 if dolock:
199 if dolock:
@@ -244,7 +249,7 b' class lock(object):'
244 while not self.held and retry:
249 while not self.held and retry:
245 retry -= 1
250 retry -= 1
246 try:
251 try:
247 with _delayedinterrupt():
252 with self._maybedelayedinterrupt():
248 self.vfs.makelock(lockname, self.f)
253 self.vfs.makelock(lockname, self.f)
249 self.held = 1
254 self.held = 1
250 except (OSError, IOError) as why:
255 except (OSError, IOError) as why:
General Comments 0
You need to be logged in to leave comments. Login now