def release(self):
        "increment the counter, waking up a waiter if there was any"
        if self._waiters:
            scheduler.state.awoken_from_events.add(self._waiters.popleft())
        else:
            self._value += 1