8000 extmod/uasyncio: Loop exits if only Tasks awaiting Events are added · Issue #5843 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content
extmod/uasyncio: Loop exits if only Tasks awaiting Events are added #5843
Open
@kevinkk525

Description

@kevinkk525

If only Tasks are added to the Loop that are waiting for an Event to be set (or a Lock to be acquired but that makes no sense at all), the loop exits because those Tasks get removed from the main queue and put onto the waiting queue of the Event.
Use-case: Event is waiting to be set from an ISR. Will probably only ever be used without other Tasks running in minimal test-cases but would then be a problematic bug.

Expected behaviour: Loop continues to run. This needs #5795 (Events from ISR). Otherwise this problem will of course never occur.

>>> import uasyncio as asyncio
>>> ev=asyncio.Event()
>>> async def wait():
...     print("started waiting")
...     await ev.wait()
...     print("got event")
...
...
...
>>> asyncio.run(wait())
started waiting
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    extmodRelates to extmod/ directory in source

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0