Skip to content

Commit 241e7b1

Browse files
committed
uasyncio.core: Add stop() method for loop.
To allow to stop loop from a callback function.
1 parent bf327f7 commit 241e7b1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

uasyncio.core/uasyncio/core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ def _run_and_stop():
128128
self.call_soon(_run_and_stop())
129129
self.run_forever()
130130

131+
def stop(self):
132+
self.call_soon((lambda: (yield StopLoop(0)))())
133+
131134
def close(self):
132135
pass
133136

0 commit comments

Comments
 (0)