MCPcopy Index your code
hub / github.com/InternLM/lmdeploy / CounterEvent

Class CounterEvent

lmdeploy/pytorch/engine/engine_loop.py:37–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36
37class CounterEvent(asyncio.Event):
38
39 def __init__(self):
40 super().__init__()
41 self._counter = 0
42
43 def set(self):
44 if self._counter > 0:
45 self._counter -= 1
46 if self._counter == 0:
47 super().set()
48
49 def clear(self):
50 if self._counter == 0 and super().is_set():
51 super().clear()
52 self._counter += 1
53
54
55class RunableEventAsync:

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected