mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
sync: document runtime compatibility (#6833)
This commit is contained in:
@@ -431,6 +431,20 @@
|
|||||||
//! number of permits, which tasks may request in order to enter a critical
|
//! number of permits, which tasks may request in order to enter a critical
|
||||||
//! section. Semaphores are useful for implementing limiting or bounding of
|
//! section. Semaphores are useful for implementing limiting or bounding of
|
||||||
//! any kind.
|
//! any kind.
|
||||||
|
//!
|
||||||
|
//! # Runtime compatibility
|
||||||
|
//!
|
||||||
|
//! All synchronization primitives provided in this module are runtime agnostic.
|
||||||
|
//! You can freely move them between different instances of the Tokio runtime
|
||||||
|
//! or even use them from non-Tokio runtimes.
|
||||||
|
//!
|
||||||
|
//! When used in a Tokio runtime, the synchronization primitives participate in
|
||||||
|
//! [cooperative scheduling](crate::task#cooperative-scheduling) to avoid
|
||||||
|
//! starvation. This feature does not apply when used from non-Tokio runtimes.
|
||||||
|
//!
|
||||||
|
//! As an exception, methods ending in `_timeout` are not runtime agnostic
|
||||||
|
//! because they require access to the Tokio timer. See the documentation of
|
||||||
|
//! each `*_timeout` method for more information on its use.
|
||||||
|
|
||||||
cfg_sync! {
|
cfg_sync! {
|
||||||
/// Named future types.
|
/// Named future types.
|
||||||
|
|||||||
@@ -70,13 +70,17 @@
|
|||||||
//!
|
//!
|
||||||
//! # Multiple runtimes
|
//! # Multiple runtimes
|
||||||
//!
|
//!
|
||||||
//! The mpsc channel does not care about which runtime you use it in, and can be
|
//! The `mpsc` channel is runtime agnostic. You can freely move it between
|
||||||
//! used to send messages from one runtime to another. It can also be used in
|
//! different instances of the Tokio runtime or even use it from non-Tokio
|
||||||
//! non-Tokio runtimes.
|
//! runtimes.
|
||||||
//!
|
//!
|
||||||
//! There is one exception to the above: the [`send_timeout`] must be used from
|
//! When used in a Tokio runtime, it participates in
|
||||||
//! within a Tokio runtime, however it is still not tied to one specific Tokio
|
//! [cooperative scheduling](crate::task#cooperative-scheduling) to avoid
|
||||||
//! runtime, and the sender may be moved from one Tokio runtime to another.
|
//! starvation. This feature does not apply when used from non-Tokio runtimes.
|
||||||
|
//!
|
||||||
|
//! As an exception, methods ending in `_timeout` are not runtime agnostic
|
||||||
|
//! because they require access to the Tokio timer. See the documentation of
|
||||||
|
//! each `*_timeout` method for more information on its use.
|
||||||
//!
|
//!
|
||||||
//! # Allocation behavior
|
//! # Allocation behavior
|
||||||
//!
|
//!
|
||||||
|
|||||||
Reference in New Issue
Block a user