-
-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Winforms-compatible asyncio Proactor. #741
Conversation
This is a work in progress; there's one more improvement to come. The current implementation relies on the existence of a main window, and ties the delayed execution to the form for that window. @hawkowl suggested an additional change to use ApplicationContext() as the main runnable, which would enable us to decouple the "application" lifecycle from the main form. |
The underlying bug preventing a full transition to an AppContext version of this patch can be found here: pythonnet/pythonnet#965 |
… based operation.
I've merged this because it doesn't appear that there's a simple fix for the Python.net binding, and an asyncio implementation that works at all is better than what we have right now. I've opened #750 to track the future work that can be done to improve this implementation. |
Integrates the Winforms event handling lifecycle with the asyncio event loop.
This is done by instantiating a Proactor, but customizing the Proactor so that
run_forever()
is split into two parts;setup_run_forever()
andtick()
. Thetick()
component is what historically would have been run as a tight "while True" loop; in this version, the call to tick is scheduled to run every 5ms using the winforms event infrastructure.It also involves some refactoring of the winforms libs - they were starting to get unwieldly, and introducing the Proactor was a good opportunity to modularize that code.
Huge thanks for @hawkowl for the many, many pointers on getting this going.