-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Problem description
Two plugins wanting to use the asyncio
module will have to interact with an event loop. The "main" loop can be obtained via asyncio.get_event_loop()
. With build 4057 this loop is not yet running. This poses a "race condition" if two or more plugins want to use this global loop.
All plugins could first check for a running loop, and start it if it hasn't started yet.
Some plugin authors might forget, or might just not care and start it anyway.
Some plugin authors might create their own separate loop with my_loop = asyncio.new_event_loop()
and starting it with threading.Thread(target=my_loop.run_forever)
. This last possibility is especially annoying, because the global loop from asyncio.get_event_loop()
gives ST4 an opportunity to reduce its Python thread count. That is, using such a global loop is usually a superior alternative to firing up threads.
Preferred solution
SublimeText should start the global event loop from asyncio
before loading plugins.
This guarantees all plugins a global running loop.
Additional Information (optional)
SublimeText build 4057.