def acquire_shared(self, shared_lock: SharedLock) -> bool: # respects wall-time timeout, see issue9892 if self.infinite: return shared_lock.acquire_shared() remain = self.remain # there is no special handling for case remain == 0.0, because that while remain > 0.0: # would mean request deadline hence performance is no longer an issue if shared_lock.acquire_shared(remain): return True remain = self.remain else: return False
def acquire_shared( self, shared_lock: SharedLock ) -> bool: # respects wall-time timeout, see issue9892 if self.infinite: return shared_lock.acquire_shared() remain = self.remain # there is no special handling for case remain == 0.0, because that while remain > 0.0: # would mean request deadline hence performance is no longer an issue if shared_lock.acquire_shared(remain): return True remain = self.remain else: return False
def acquire_shared_fast(self, shared_lock: SharedLock) -> bool: # respects wall-time timeout, see issue9892 if shared_lock.acquire_shared(0.0): # shared lock accepts zero timeout return True return self.acquire_shared(shared_lock)
def acquire_shared_fast( self, shared_lock: SharedLock ) -> bool: # respects wall-time timeout, see issue9892 if shared_lock.acquire_shared(0.0): # shared lock accepts zero timeout return True return self.acquire_shared(shared_lock)