Skip to content

Commit

Permalink
doc: focus motivation for using alternatives of select! on cancella…
Browse files Browse the repository at this point in the history
…tion safety problems
  • Loading branch information
Ddystopia committed Jan 28, 2025
1 parent 1cc15e3 commit 03eed09
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tokio/src/macros/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,13 @@ macro_rules! doc {
/// ```
/// # Alternatives from the Ecosystem
///
/// The `select!` macro is a versatile tool for working with multiple asynchronous
/// branches, allowing tasks to run concurrently within the same thread. However,
/// depending on your use case, ecosystem alternatives can provide additional
/// benefits, such as more straightforward syntax, more transparent control flow or
/// reducing the burned of cancellation safety or fuse semantics.
/// The select! macro is a powerful tool for managing multiple asynchronous
/// branches, enabling tasks to run concurrently within the same thread. However,
/// its use can introduce challenges, particularly around cancellation safety, which
/// can lead to subtle and hard-to-debug errors. For many use cases, ecosystem
/// alternatives may be preferable as they mitigate these concerns by offering
/// clearer syntax, more predictable control flow, and reducing the need to manually
/// handle issues like fuse semantics or cancellation safety.
///
/// ## Merging Streams
///
Expand Down

0 comments on commit 03eed09

Please sign in to comment.