mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Improve interoperability with threads
This commit is contained in:
parent
1885acd594
commit
fde55a4a7f
1 changed files with 1 additions and 1 deletions
|
|
@ -58,7 +58,7 @@ def async_to_sync(obj, name):
|
||||||
loop = asyncio.new_event_loop()
|
loop = asyncio.new_event_loop()
|
||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
|
|
||||||
if threading.current_thread() is threading.main_thread():
|
if threading.current_thread() is threading.main_thread() or not main_loop.is_running():
|
||||||
if loop.is_running():
|
if loop.is_running():
|
||||||
return coroutine
|
return coroutine
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue