##// END OF EJS Templates
lock.release: don't call postrelease functions for inherited locks...
Siddharth Agarwal -
r26474:431094a3 default
parent child Browse files
Show More
@@ -221,8 +221,11 b' class lock(object):'
221 self.vfs.unlink(self.f)
221 self.vfs.unlink(self.f)
222 except OSError:
222 except OSError:
223 pass
223 pass
224 for callback in self.postrelease:
224 # The postrelease functions typically assume the lock is not held
225 callback()
225 # at all.
226 if not self._parentheld:
227 for callback in self.postrelease:
228 callback()
226
229
227 def release(*locks):
230 def release(*locks):
228 for lock in locks:
231 for lock in locks:
@@ -169,7 +169,7 b' class testlock(unittest.TestCase):'
169
169
170 childlock.release()
170 childlock.release()
171 childstate.assertreleasecalled(True)
171 childstate.assertreleasecalled(True)
172 childstate.assertpostreleasecalled(True)
172 childstate.assertpostreleasecalled(False)
173 childstate.assertlockexists(True)
173 childstate.assertlockexists(True)
174
174
175 parentstate.resetacquirefn()
175 parentstate.resetacquirefn()
@@ -208,7 +208,7 b' class testlock(unittest.TestCase):'
208
208
209 lock2.release()
209 lock2.release()
210 state2.assertreleasecalled(True)
210 state2.assertreleasecalled(True)
211 state2.assertpostreleasecalled(True)
211 state2.assertpostreleasecalled(False)
212 state2.assertlockexists(True)
212 state2.assertlockexists(True)
213
213
214 state1.resetacquirefn()
214 state1.resetacquirefn()
@@ -217,7 +217,7 b' class testlock(unittest.TestCase):'
217
217
218 lock1.release()
218 lock1.release()
219 state1.assertreleasecalled(True)
219 state1.assertreleasecalled(True)
220 state1.assertpostreleasecalled(True)
220 state1.assertpostreleasecalled(False)
221 state1.assertlockexists(True)
221 state1.assertlockexists(True)
222
222
223 lock0.release()
223 lock0.release()
@@ -245,7 +245,7 b' class testlock(unittest.TestCase):'
245 # release the child lock
245 # release the child lock
246 childlock.release()
246 childlock.release()
247 childstate.assertreleasecalled(True)
247 childstate.assertreleasecalled(True)
248 childstate.assertpostreleasecalled(True)
248 childstate.assertpostreleasecalled(False)
249 childstate.assertlockexists(True)
249 childstate.assertlockexists(True)
250
250
251 parentlock.release()
251 parentlock.release()
General Comments 0
You need to be logged in to leave comments. Login now