Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions tokio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,15 @@
//! ```
//!
//! If your code is CPU-bound and you wish to limit the number of threads used
//! to run it, you should run it on another thread pool such as [rayon]. You
//! can use an [`oneshot`] channel to send the result back to Tokio when the
//! rayon task finishes.
//! to run it, you should use a separate thread pool dedicated to CPU bound tasks
//! and *NOT* the same [`Runtime`] used to handle latency sensitive IO tasks.
//!
//! For example, you might consider using the [rayon] library or an
//! additional tokio [`Runtime`] instance other than the one used to handle
//! IO.
//!
//! Hint: If using rayon, you can use a [`oneshot`] channel to send the result back
//! to Tokio when the rayon task finishes.
//!
//! [rayon]: https://docs.rs/rayon
//! [`oneshot`]: crate::sync::oneshot
Expand Down