structio.thread.run_coro now makes sure the event loop is running before submitting tasks
This commit is contained in:
parent
d5b9564d7a
commit
2aecb7f440
|
@ -346,7 +346,7 @@ def run_coro(
|
|||
pass
|
||||
else:
|
||||
raise StructIOException("cannot be called from async context")
|
||||
if not is_async_thread():
|
||||
if not is_async_thread() or _storage.parent_loop.done():
|
||||
raise StructIOException("run_coro requires a running loop in another thread!")
|
||||
# Wake up the event loop if it's blocked in a call to select() or similar I/O routine
|
||||
_storage.coro_runner.wakeup()
|
||||
|
|
Loading…
Reference in New Issue