mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
@@ -793,7 +793,7 @@ where
|
|||||||
/// This is useful for a flavor of "optimistic check" before deciding to
|
/// This is useful for a flavor of "optimistic check" before deciding to
|
||||||
/// await on a receiver.
|
/// await on a receiver.
|
||||||
///
|
///
|
||||||
/// Compared with [`recv`], this function has three failure cases instead of one
|
/// Compared with [`recv`], this function has three failure cases instead of two
|
||||||
/// (one for closed, one for an empty buffer, one for a lagging receiver).
|
/// (one for closed, one for an empty buffer, one for a lagging receiver).
|
||||||
///
|
///
|
||||||
/// `Err(TryRecvError::Closed)` is returned when all `Sender` halves have
|
/// `Err(TryRecvError::Closed)` is returned when all `Sender` halves have
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
//! few flavors of channels provided by Tokio. Each channel flavor supports
|
//! few flavors of channels provided by Tokio. Each channel flavor supports
|
||||||
//! different message passing patterns. When a channel supports multiple
|
//! different message passing patterns. When a channel supports multiple
|
||||||
//! producers, many separate tasks may **send** messages. When a channel
|
//! producers, many separate tasks may **send** messages. When a channel
|
||||||
//! supports muliple consumers, many different separate tasks may **receive**
|
//! supports multiple consumers, many different separate tasks may **receive**
|
||||||
//! messages.
|
//! messages.
|
||||||
//!
|
//!
|
||||||
//! Tokio provides many different channel flavors as different message passing
|
//! Tokio provides many different channel flavors as different message passing
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::batch_semaphore as ll; // low level implementation
|
use super::batch_semaphore as ll; // low level implementation
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
/// Counting semaphore performing asynchronous permit aquisition.
|
/// Counting semaphore performing asynchronous permit acquisition.
|
||||||
///
|
///
|
||||||
/// A semaphore maintains a set of permits. Permits are used to synchronize
|
/// A semaphore maintains a set of permits. Permits are used to synchronize
|
||||||
/// access to a shared resource. A semaphore differs from a mutex in that it
|
/// access to a shared resource. A semaphore differs from a mutex in that it
|
||||||
|
|||||||
@@ -910,7 +910,7 @@ impl Waiter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Try to decrement the number of permits to acquire. This returns the
|
/// Try to decrement the number of permits to acquire. This returns the
|
||||||
/// actual number of permits that were decremented. The delta betweeen `n`
|
/// actual number of permits that were decremented. The delta between `n`
|
||||||
/// and the return has been assigned to the permit and the caller must
|
/// and the return has been assigned to the permit and the caller must
|
||||||
/// assign these back to the semaphore.
|
/// assign these back to the semaphore.
|
||||||
fn try_dec_permits_to_acquire(&self, n: usize) -> usize {
|
fn try_dec_permits_to_acquire(&self, n: usize) -> usize {
|
||||||
|
|||||||
Reference in New Issue
Block a user