最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

async await - In Micropython's asyncio, how do I wait for one of two events to be set? - Stack Overflow

programmeradmin3浏览0评论

In a MicroPython project, on an ESP32 microcontroller, I have two events that I have created like so:

ev1 = asyncio.Event()
ev2 = asyncio.Event()

Now, in a co-routine, I would like to wait until one of the two events has been set. So basically something like this:

async func():
    # some code
    await ev1.wait() # but wait for ev1 OR ev2 to be set

How can I do this?

发布评论

评论列表(0)

  1. 暂无评论