def acquire(self, blocking=True): if self.value.value > 0: self.value.value -= 1 return True else: if blocking: lockless.retry() else: return False
def wait_till_complete(v, n): if v.value != n: lockless.retry()
def get(self): if len(self.obj.value) == 0: lockless.retry() else: return self.obj.value.pop(0)
def pickup(self): if self.available.value == 0: lockless.retry() else: self.available.value = 0