extmod/uasyncio: Add Loop.new_event_loop method.

This commit adds Loop.new_event_loop() which is used to reset the singleton
event loop.  This functionality is put here instead of in Loop.close() to
make it possible to write code that is compatible with CPython.
This commit is contained in:
Damien George
2020-04-09 13:15:47 +10:00
parent 1bbc15dd15
commit db137e70dc
4 changed files with 62 additions and 7 deletions

View File

@@ -244,6 +244,13 @@ Event Loop
Return the event loop used to schedule and run tasks. See `Loop`.
.. function:: new_event_loop()
Reset the event loop and return it.
Note: since MicroPython only has a single event loop this function just
resets the loop's state, it does not create a new one.
.. class:: Loop()
This represents the object which schedules and runs tasks. It cannot be