Re:Futurelock: A subtle risk in async Rust
by 0xdeafbeef on Friday October 31, 2025 @06:57PM
(#45777635)
What to use instead?
[ Parent
| on HN ]
Re:Futurelock: A subtle risk in async Rust
by surajrmal on Sunday November 02, 2025 @10:30AM
(#45791009)
Your favorite llm will give you several good options. You can use an mpsc channel where you have a task per sender which waits on each branch in the select and then sends a message and then just wait on the receiver end of that channel. Or you could use https://docs.rs/futures/latest/futures/future/fn.select.html (or the select_all version). Both make it more obvious what is going on. The last way would be to implement a future manually. This would probably be my favorite option in many cases as it would be least overhead, but if you've never implemented a future it may be a bit intimidating.
Edit: tokio docs actually provide several suggestions: https://docs.rs/tokio/latest/tokio/macro.select.html#alterna...