'Increment the counter and wake one waiter.'

def release(self):

    self._value += 1
    while self._waiters:
        waiter = self._waiters.popleft()
        if (not waiter.done()):
            self._value -= 1
            waiter.set_result(_ReleasingContextManager(self))
            break
