jbaldwin / libcoro

C++20 coroutine library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add coro::when_any

jbaldwin opened this issue · comments

Adding a when any function could prove useful to take the first tasks result that completes. This probably needs some kind of cancellation token that the user tasks should periodically check and stop executing if told they have been cancelled.

Any solution that would let coro::when_all and coro::when_any work without the THREADING option and as such not have mutexes etc available, would be highly beneficial.
(I have now implemented both metaphors including cancellation support in https://github.com/dok-net/arduino-esp32/tree/fast_scheduler_idf5.1 in a modular fashion. I haven't checked performance, but it runs on a very constrained embedded MCU, if that is any indication.)