def _doRecover(self): with self.lock: # Am I really the last? if self.ref != 0: raise se.TaskHasRefs(six.text_type(self)) self.ref += 1 try: self._updateState(State.racquiring) finally: with self.lock: self.ref -= 1
def _doRecover(self): self.lock.acquire() # Am I really the last? if self.ref != 0: self.lock.release() raise se.TaskHasRefs(unicode(self)) self.ref += 1 self.lock.release() try: self._updateState(State.racquiring) finally: self.lock.acquire() self.ref -= 1 self.lock.release()