mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-26 00:00:16 +02:00
committed by
Toby Lawrence
parent
7dc6404726
commit
82c5baa09b
@@ -21,7 +21,7 @@ race:crossbeam_epoch
|
|||||||
race:crossbeam_deque*push
|
race:crossbeam_deque*push
|
||||||
race:crossbeam_deque*steal
|
race:crossbeam_deque*steal
|
||||||
|
|
||||||
# This filters out expected data race in the treiber stack implementations.
|
# This filters out expected data race in the Treiber stack implementations.
|
||||||
# Treiber stacks are inherently racy. The pop operation will attempt to access
|
# Treiber stacks are inherently racy. The pop operation will attempt to access
|
||||||
# the "next" pointer on the node it is attempting to pop. However, at this
|
# the "next" pointer on the node it is attempting to pop. However, at this
|
||||||
# point it has not gained ownership of the node and another thread might beat
|
# point it has not gained ownership of the node and another thread might beat
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! An UDP echo server that just sends back everything that it receives.
|
//! An UDP echo server that just sends back everything that it receives.
|
||||||
//!
|
//!
|
||||||
//! If you're on unix you can test this out by in one terminal executing:
|
//! If you're on Unix you can test this out by in one terminal executing:
|
||||||
//!
|
//!
|
||||||
//! cargo run --example echo-udp
|
//! cargo run --example echo-udp
|
||||||
//!
|
//!
|
||||||
|
|||||||
+2
-2
@@ -345,7 +345,7 @@ impl Runtime {
|
|||||||
/// complete, and yielding its resolved result. Any tasks or timers which
|
/// complete, and yielding its resolved result. Any tasks or timers which
|
||||||
/// the future spawns internally will be executed on the runtime.
|
/// the future spawns internally will be executed on the runtime.
|
||||||
///
|
///
|
||||||
/// This method should not be called from an asynchrounous context.
|
/// This method should not be called from an asynchronous context.
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
@@ -370,7 +370,7 @@ impl Runtime {
|
|||||||
/// its resolved result. Any tasks or timers which the future spawns
|
/// its resolved result. Any tasks or timers which the future spawns
|
||||||
/// internally will be executed on the runtime and waited for completion.
|
/// internally will be executed on the runtime and waited for completion.
|
||||||
///
|
///
|
||||||
/// This method should not be called from an asynchrounous context.
|
/// This method should not be called from an asynchronous context.
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
|
|||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
//! is initialized with a `Duration` and repeatedly yields each time the
|
//! is initialized with a `Duration` and repeatedly yields each time the
|
||||||
//! duration elapses.
|
//! duration elapses.
|
||||||
//!
|
//!
|
||||||
//! * [`Timeout`][Timeeout]: Wraps a future or stream, setting an upper bound to the
|
//! * [`Timeout`][Timeout]: Wraps a future or stream, setting an upper bound to the
|
||||||
//! amount of time it is allowed to execute. If the future or stream does not
|
//! amount of time it is allowed to execute. If the future or stream does not
|
||||||
//! completee in time, then it is canceled and an error is returned.
|
//! complete in time, then it is canceled and an error is returned.
|
||||||
//!
|
//!
|
||||||
//! * [`DelayQueue`]: A queue where items are returned once the requested delay
|
//! * [`DelayQueue`]: A queue where items are returned once the requested delay
|
||||||
//! has expired.
|
//! has expired.
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ struct Inner<U> {
|
|||||||
head_readiness: AtomicPtr<Node<U>>,
|
head_readiness: AtomicPtr<Node<U>>,
|
||||||
tail_readiness: UnsafeCell<*const Node<U>>,
|
tail_readiness: UnsafeCell<*const Node<U>>,
|
||||||
|
|
||||||
// Used as part of the MPSC queue algorithm
|
// Used as part of the mpsc queue algorithm
|
||||||
stub: Arc<Node<U>>,
|
stub: Arc<Node<U>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ where U: Unpark,
|
|||||||
// being released, another thread notified it, which
|
// being released, another thread notified it, which
|
||||||
// resulted in it getting pushed into the mpsc channel.
|
// resulted in it getting pushed into the mpsc channel.
|
||||||
//
|
//
|
||||||
// In this case, we just dec the ref count.
|
// In this case, we just decrement the ref count.
|
||||||
let node = ptr2arc(node);
|
let node = ptr2arc(node);
|
||||||
assert!((*node.next_all.get()).is_null());
|
assert!((*node.next_all.get()).is_null());
|
||||||
assert!((*node.prev_all.get()).is_null());
|
assert!((*node.prev_all.get()).is_null());
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ fn turn_has_polled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Our own mock Park that is never really waiting and the only
|
// Our own mock Park that is never really waiting and the only
|
||||||
// thing it does is to send, on request, something (once) to a onshot
|
// thing it does is to send, on request, something (once) to a oneshot
|
||||||
// channel
|
// channel
|
||||||
struct MyPark {
|
struct MyPark {
|
||||||
sender: Option<oneshot::Sender<()>>,
|
sender: Option<oneshot::Sender<()>>,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ executor, including:
|
|||||||
* The [`Executor`] trait describes the API for spawning a future onto an
|
* The [`Executor`] trait describes the API for spawning a future onto an
|
||||||
executor.
|
executor.
|
||||||
|
|
||||||
* [`enter`] marks that the the current thread is entering an execution
|
* [`enter`] marks that the current thread is entering an execution
|
||||||
context. This prevents a second executor from accidentally starting from
|
context. This prevents a second executor from accidentally starting from
|
||||||
within the context of one that is already running.
|
within the context of one that is already running.
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
//! * The [`Executor`] trait describes the API for spawning a future onto an
|
//! * The [`Executor`] trait describes the API for spawning a future onto an
|
||||||
//! executor.
|
//! executor.
|
||||||
//!
|
//!
|
||||||
//! * [`enter`] marks that the the current thread is entering an execution
|
//! * [`enter`] marks that the current thread is entering an execution
|
||||||
//! context. This prevents a second executor from accidentally starting from
|
//! context. This prevents a second executor from accidentally starting from
|
||||||
//! within the context of one that is already running.
|
//! within the context of one that is already running.
|
||||||
//!
|
//!
|
||||||
@@ -114,7 +114,7 @@ pub trait Executor {
|
|||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// Implementors are encouraged to avoid panics. However, a panic is
|
/// Implementers are encouraged to avoid panics. However, a panic is
|
||||||
/// permitted and the caller should check the implementation specific
|
/// permitted and the caller should check the implementation specific
|
||||||
/// documentation for more details on possible panics.
|
/// documentation for more details on possible panics.
|
||||||
///
|
///
|
||||||
@@ -148,7 +148,7 @@ pub trait Executor {
|
|||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// This function must not panic. Implementors must ensure that panics do
|
/// This function must not panic. Implementers must ensure that panics do
|
||||||
/// not happen.
|
/// not happen.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// For now, we need to keep the implmentation of Encoder in tokio_io.
|
// For now, we need to keep the implementation of Encoder in tokio_io.
|
||||||
|
|
||||||
pub use codec::Decoder;
|
pub use codec::Decoder;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// For now, we need to keep the implmentation of Encoder in tokio_io.
|
// For now, we need to keep the implementation of Encoder in tokio_io.
|
||||||
|
|
||||||
pub use codec::Encoder;
|
pub use codec::Encoder;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ pub trait AsyncRead: std_io::Read {
|
|||||||
/// `prepare_uninitialized_buffer`.
|
/// `prepare_uninitialized_buffer`.
|
||||||
///
|
///
|
||||||
/// This function isn't actually `unsafe` to call but `unsafe` to implement.
|
/// This function isn't actually `unsafe` to call but `unsafe` to implement.
|
||||||
/// The implementor must ensure that either the whole `buf` has been zeroed
|
/// The implementer must ensure that either the whole `buf` has been zeroed
|
||||||
/// or `read_buf()` overwrites the buffer without reading it and returns
|
/// or `read_buf()` overwrites the buffer without reading it and returns
|
||||||
/// correct value.
|
/// correct value.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ pub trait AsyncWrite: std_io::Write {
|
|||||||
/// appropriate. This method is the hook for such protocols to implement the
|
/// appropriate. This method is the hook for such protocols to implement the
|
||||||
/// graceful shutdown logic.
|
/// graceful shutdown logic.
|
||||||
///
|
///
|
||||||
/// This `shutdown` method is required by implementors of the
|
/// This `shutdown` method is required by implementers of the
|
||||||
/// `AsyncWrite` trait. Wrappers typically just want to proxy this call
|
/// `AsyncWrite` trait. Wrappers typically just want to proxy this call
|
||||||
/// through to the wrapped type, and base types will typically implement
|
/// through to the wrapped type, and base types will typically implement
|
||||||
/// shutdown logic here or just return `Ok(().into())`. Note that if you're
|
/// shutdown logic here or just return `Ok(().into())`. Note that if you're
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ impl<T, U> Framed<T, U> {
|
|||||||
/// being worked with.
|
/// being worked with.
|
||||||
pub fn into_parts(self) -> FramedParts<T> {
|
pub fn into_parts(self) -> FramedParts<T> {
|
||||||
let (inner, readbuf) = self.inner.into_parts();
|
let (inner, readbuf) = self.inner.into_parts();
|
||||||
let (inner, writebuf) = inner.into_parts();
|
let (inner, writebuf) = inner.into_parts();
|
||||||
FramedParts { inner: inner.0, readbuf: readbuf, writebuf: writebuf }
|
FramedParts { inner: inner.0, readbuf: readbuf, writebuf: writebuf }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ impl TcpStream {
|
|||||||
///
|
///
|
||||||
/// This function will create a new TCP socket and attempt to connect it to
|
/// This function will create a new TCP socket and attempt to connect it to
|
||||||
/// the `addr` provided. The returned future will be resolved once the
|
/// the `addr` provided. The returned future will be resolved once the
|
||||||
/// stream has successfully connected, or it wil return an error if one
|
/// stream has successfully connected, or it will return an error if one
|
||||||
/// occurs.
|
/// occurs.
|
||||||
pub fn connect(addr: &SocketAddr) -> ConnectFuture {
|
pub fn connect(addr: &SocketAddr) -> ConnectFuture {
|
||||||
use self::ConnectFutureState::*;
|
use self::ConnectFutureState::*;
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ extern crate log;
|
|||||||
//
|
//
|
||||||
// ## Sleeping workers
|
// ## Sleeping workers
|
||||||
//
|
//
|
||||||
// Sleeping workers are tracked using a [treiber stack]. This results in the
|
// Sleeping workers are tracked using a [Treiber stack]. This results in the
|
||||||
// thread that most recently went to sleep getting woken up first. When the pool
|
// thread that most recently went to sleep getting woken up first. When the pool
|
||||||
// is not under load, this helps threads shutdown faster.
|
// is not under load, this helps threads shutdown faster.
|
||||||
//
|
//
|
||||||
@@ -137,7 +137,7 @@ extern crate log;
|
|||||||
// Also, whenever a worker is woken up via a signal and it does find work, it,
|
// Also, whenever a worker is woken up via a signal and it does find work, it,
|
||||||
// in turn, will try to wake up a new worker.
|
// in turn, will try to wake up a new worker.
|
||||||
//
|
//
|
||||||
// [treiber stack]: https://en.wikipedia.org/wiki/Treiber_Stack
|
// [Treiber stack]: https://en.wikipedia.org/wiki/Treiber_Stack
|
||||||
|
|
||||||
pub mod park;
|
pub mod park;
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ pub(crate) struct Backup {
|
|||||||
/// * If the thread is running
|
/// * If the thread is running
|
||||||
state: AtomicUsize,
|
state: AtomicUsize,
|
||||||
|
|
||||||
/// Next entry in the treiber stack.
|
/// Next entry in the Treiber stack.
|
||||||
next_sleeper: UnsafeCell<BackupId>,
|
next_sleeper: UnsafeCell<BackupId>,
|
||||||
|
|
||||||
/// Used to put the thread to sleep
|
/// Used to put the thread to sleep
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ pub(crate) const EMPTY: BackupId = BackupId(MAX_BACKUP);
|
|||||||
/// Used to mark the stack as terminated
|
/// Used to mark the stack as terminated
|
||||||
pub(crate) const TERMINATED: BackupId = BackupId(EMPTY.0 + 1);
|
pub(crate) const TERMINATED: BackupId = BackupId(EMPTY.0 + 1);
|
||||||
|
|
||||||
/// How many bits the treiber ABA guard is offset by
|
/// How many bits the Treiber ABA guard is offset by
|
||||||
const ABA_GUARD_SHIFT: usize = 16;
|
const ABA_GUARD_SHIFT: usize = 16;
|
||||||
|
|
||||||
#[cfg(target_pointer_width = "64")]
|
#[cfg(target_pointer_width = "64")]
|
||||||
@@ -165,7 +165,7 @@ impl State {
|
|||||||
fn set_head(&mut self, val: BackupId) {
|
fn set_head(&mut self, val: BackupId) {
|
||||||
let val = val.0;
|
let val = val.0;
|
||||||
|
|
||||||
// The ABA guard protects against the ABA problem w/ treiber stacks
|
// The ABA guard protects against the ABA problem w/ Treiber stacks
|
||||||
let aba_guard = ((self.0 >> ABA_GUARD_SHIFT) + 1) & ABA_GUARD_MASK;
|
let aba_guard = ((self.0 >> ABA_GUARD_SHIFT) + 1) & ABA_GUARD_MASK;
|
||||||
|
|
||||||
self.0 = (aba_guard << ABA_GUARD_SHIFT) | val;
|
self.0 = (aba_guard << ABA_GUARD_SHIFT) | val;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use std::thread;
|
|||||||
/// Manages the state around entering a blocking section and tasks that are
|
/// Manages the state around entering a blocking section and tasks that are
|
||||||
/// queued pending the ability to block.
|
/// queued pending the ability to block.
|
||||||
///
|
///
|
||||||
/// This is a hybrid counter and instrusive mpsc channel (like `Queue`).
|
/// This is a hybrid counter and intrusive mpsc channel (like `Queue`).
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct Blocking {
|
pub(crate) struct Blocking {
|
||||||
/// Queue head.
|
/// Queue head.
|
||||||
|
|||||||
@@ -732,7 +732,7 @@ impl Worker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Shutdown | Running => {
|
Shutdown | Running => {
|
||||||
// To get here, the block above transitioned the tate to
|
// To get here, the block above transitioned the state to
|
||||||
// `Sleeping`. No other thread can concurrently
|
// `Sleeping`. No other thread can concurrently
|
||||||
// transition to `Shutdown` or `Running`.
|
// transition to `Shutdown` or `Running`.
|
||||||
unreachable!();
|
unreachable!();
|
||||||
@@ -805,7 +805,7 @@ impl Worker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Shutdown | Running => {
|
Shutdown | Running => {
|
||||||
// To get here, the block above transitioned the tate to
|
// To get here, the block above transitioned the state to
|
||||||
// `Sleeping`. No other thread can concurrently
|
// `Sleeping`. No other thread can concurrently
|
||||||
// transition to `Shutdown` or `Running`.
|
// transition to `Shutdown` or `Running`.
|
||||||
unreachable!();
|
unreachable!();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ pub(crate) const EMPTY: usize = MAX_WORKERS;
|
|||||||
/// Used to mark the stack as terminated
|
/// Used to mark the stack as terminated
|
||||||
pub(crate) const TERMINATED: usize = EMPTY + 1;
|
pub(crate) const TERMINATED: usize = EMPTY + 1;
|
||||||
|
|
||||||
/// How many bits the treiber ABA guard is offset by
|
/// How many bits the Treiber ABA guard is offset by
|
||||||
const ABA_GUARD_SHIFT: usize = 16;
|
const ABA_GUARD_SHIFT: usize = 16;
|
||||||
|
|
||||||
#[cfg(target_pointer_width = "64")]
|
#[cfg(target_pointer_width = "64")]
|
||||||
@@ -215,7 +215,7 @@ impl State {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn set_head(&mut self, val: usize) {
|
fn set_head(&mut self, val: usize) {
|
||||||
// The ABA guard protects against the ABA problem w/ treiber stacks
|
// The ABA guard protects against the ABA problem w/ Treiber stacks
|
||||||
let aba_guard = ((self.0 >> ABA_GUARD_SHIFT) + 1) & ABA_GUARD_MASK;
|
let aba_guard = ((self.0 >> ABA_GUARD_SHIFT) + 1) & ABA_GUARD_MASK;
|
||||||
|
|
||||||
self.0 = (aba_guard << ABA_GUARD_SHIFT) | val;
|
self.0 = (aba_guard << ABA_GUARD_SHIFT) | val;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ mod imp {
|
|||||||
mod imp {
|
mod imp {
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AtomicU64 {
|
pub struct AtomicU64 {
|
||||||
inner: Mutex<u64>,
|
inner: Mutex<u64>,
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ struct Data<T> {
|
|||||||
/// Next entry in the stack
|
/// Next entry in the stack
|
||||||
next: Option<usize>,
|
next: Option<usize>,
|
||||||
|
|
||||||
/// Previous entry in the stac
|
/// Previous entry in the stack
|
||||||
prev: Option<usize>,
|
prev: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ impl<T> DelayQueue<T> {
|
|||||||
/// use tokio_timer::timer::Handle;
|
/// use tokio_timer::timer::Handle;
|
||||||
///
|
///
|
||||||
/// let handle = Handle::default();
|
/// let handle = Handle::default();
|
||||||
/// let deplay_queue: DelayQueue<u32> = DelayQueue::with_capacity_and_handle(0, &handle);
|
/// let delay_queue: DelayQueue<u32> = DelayQueue::with_capacity_and_handle(0, &handle);
|
||||||
/// ```
|
/// ```
|
||||||
pub fn with_capacity_and_handle(capacity: usize, handle: &Handle) -> DelayQueue<T> {
|
pub fn with_capacity_and_handle(capacity: usize, handle: &Handle) -> DelayQueue<T> {
|
||||||
DelayQueue {
|
DelayQueue {
|
||||||
@@ -282,7 +282,7 @@ impl<T> DelayQueue<T> {
|
|||||||
///
|
///
|
||||||
/// The return value represents the insertion and is used at an argument to
|
/// The return value represents the insertion and is used at an argument to
|
||||||
/// [`remove`] and [`reset`]. Note that [`Key`] is token and is reused once
|
/// [`remove`] and [`reset`]. Note that [`Key`] is token and is reused once
|
||||||
/// `value` is removed from the queue eitheer by calling [`poll`] after
|
/// `value` is removed from the queue either by calling [`poll`] after
|
||||||
/// `when` is reached or by calling [`remove`]. At this point, the caller
|
/// `when` is reached or by calling [`remove`]. At this point, the caller
|
||||||
/// must take care to not use the returned [`Key`] again as it may reference
|
/// must take care to not use the returned [`Key`] again as it may reference
|
||||||
/// a different item in the queue.
|
/// a different item in the queue.
|
||||||
@@ -350,7 +350,7 @@ impl<T> DelayQueue<T> {
|
|||||||
///
|
///
|
||||||
/// The return value represents the insertion and is used at an argument to
|
/// The return value represents the insertion and is used at an argument to
|
||||||
/// [`remove`] and [`reset`]. Note that [`Key`] is token and is reused once
|
/// [`remove`] and [`reset`]. Note that [`Key`] is token and is reused once
|
||||||
/// `value` is removed from the queue eitheer by calling [`poll`] after
|
/// `value` is removed from the queue either by calling [`poll`] after
|
||||||
/// `when` is reached or by calling [`remove`]. At this point, the caller
|
/// `when` is reached or by calling [`remove`]. At this point, the caller
|
||||||
/// must take care to not use the returned [`Key`] again as it may reference
|
/// must take care to not use the returned [`Key`] again as it may reference
|
||||||
/// a different item in the queue.
|
/// a different item in the queue.
|
||||||
@@ -485,7 +485,7 @@ impl<T> DelayQueue<T> {
|
|||||||
///
|
///
|
||||||
/// delay_queue.reset_at(&key, Instant::now() + Duration::from_secs(10));
|
/// delay_queue.reset_at(&key, Instant::now() + Duration::from_secs(10));
|
||||||
///
|
///
|
||||||
/// // "foo"is now scheduledto be returned in 10 seconds
|
/// // "foo"is now scheduled to be returned in 10 seconds
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn reset_at(&mut self, key: &Key, when: Instant) {
|
pub fn reset_at(&mut self, key: &Key, when: Instant) {
|
||||||
@@ -541,7 +541,7 @@ impl<T> DelayQueue<T> {
|
|||||||
///
|
///
|
||||||
/// delay_queue.reset(&key, Duration::from_secs(10));
|
/// delay_queue.reset(&key, Duration::from_secs(10));
|
||||||
///
|
///
|
||||||
/// // "foo"is now scheduledto be returned in 10 seconds
|
/// // "foo"is now scheduled to be returned in 10 seconds
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn reset(&mut self, key: &Key, timeout: Duration) {
|
pub fn reset(&mut self, key: &Key, timeout: Duration) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
//!
|
//!
|
||||||
//! * [`Timeout`]: Wraps a future or stream, setting an upper bound to the
|
//! * [`Timeout`]: Wraps a future or stream, setting an upper bound to the
|
||||||
//! amount of time it is allowed to execute. If the future or stream does not
|
//! amount of time it is allowed to execute. If the future or stream does not
|
||||||
//! completee in time, then it is canceled and an error is returned.
|
//! complete in time, then it is canceled and an error is returned.
|
||||||
//!
|
//!
|
||||||
//! * [`DelayQueue`]: A queue where items are returned once the requested delay
|
//! * [`DelayQueue`]: A queue where items are returned once the requested delay
|
||||||
//! has expired.
|
//! has expired.
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ where
|
|||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
///
|
///
|
||||||
/// * `when`: is the instant at which the the entry should be fired. It is
|
/// * `when`: is the instant at which the entry should be fired. It is
|
||||||
/// represented as the number of milliseconds since the creation
|
/// represented as the number of milliseconds since the creation
|
||||||
/// of the timing wheel.
|
/// of the timing wheel.
|
||||||
///
|
///
|
||||||
@@ -98,9 +98,9 @@ where
|
|||||||
///
|
///
|
||||||
/// `Err(Elapsed)` indicates that `when` represents an instant that has
|
/// `Err(Elapsed)` indicates that `when` represents an instant that has
|
||||||
/// already passed. In this case, the caller should fire the timeout
|
/// already passed. In this case, the caller should fire the timeout
|
||||||
/// immediateely.
|
/// immediately.
|
||||||
///
|
///
|
||||||
/// `Err(Invalid)` indicates an invalid `when` argumeent as been supplied.
|
/// `Err(Invalid)` indicates an invalid `when` argument as been supplied.
|
||||||
pub fn insert(&mut self, when: u64, item: T::Owned, store: &mut T::Store)
|
pub fn insert(&mut self, when: u64, item: T::Owned, store: &mut T::Store)
|
||||||
-> Result<(), (T::Owned, InsertError)>
|
-> Result<(), (T::Owned, InsertError)>
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ extern crate tokio_tls;
|
|||||||
use tokio_tls::{TlsConnector, TlsAcceptor};
|
use tokio_tls::{TlsConnector, TlsAcceptor};
|
||||||
```
|
```
|
||||||
|
|
||||||
You can find few examples how to use this crate in examples directory (using TLS in
|
You can find few examples how to use this crate in examples directory (using TLS in
|
||||||
hyper server or client).
|
hyper server or client).
|
||||||
|
|
||||||
By default the `native-tls` crate currently uses the "platform appropriate"
|
By default the `native-tls` crate currently uses the "platform appropriate"
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ impl UnixDatagram {
|
|||||||
|
|
||||||
/// Creates an unnamed pair of connected sockets.
|
/// Creates an unnamed pair of connected sockets.
|
||||||
///
|
///
|
||||||
/// This function will create a pair of interconnected unix sockets for
|
/// This function will create a pair of interconnected Unix sockets for
|
||||||
/// communicating back and forth between one another. Each socket will be
|
/// communicating back and forth between one another. Each socket will be
|
||||||
/// associated with the event loop whose handle is also provided.
|
/// associated with the event loop whose handle is also provided.
|
||||||
pub fn pair() -> io::Result<(UnixDatagram, UnixDatagram)> {
|
pub fn pair() -> io::Result<(UnixDatagram, UnixDatagram)> {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use std::os::unix::io::{AsRawFd, RawFd};
|
|||||||
use std::os::unix::net::{self, SocketAddr};
|
use std::os::unix::net::{self, SocketAddr};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
/// A Unix socket which can accept connections from other unix sockets.
|
/// A Unix socket which can accept connections from other Unix sockets.
|
||||||
pub struct UnixListener {
|
pub struct UnixListener {
|
||||||
io: PollEvented<mio_uds::UnixListener>,
|
io: PollEvented<mio_uds::UnixListener>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use std::os::unix::io::{AsRawFd, RawFd};
|
|||||||
use std::os::unix::net::{self, SocketAddr};
|
use std::os::unix::net::{self, SocketAddr};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
/// A structure representing a connected unix socket.
|
/// A structure representing a connected Unix socket.
|
||||||
///
|
///
|
||||||
/// This socket can be connected directly with `UnixStream::connect` or accepted
|
/// This socket can be connected directly with `UnixStream::connect` or accepted
|
||||||
/// from a listener with `UnixListener::incoming`. Additionally, a pair of
|
/// from a listener with `UnixListener::incoming`. Additionally, a pair of
|
||||||
@@ -43,7 +43,7 @@ enum State {
|
|||||||
impl UnixStream {
|
impl UnixStream {
|
||||||
/// Connects to the socket named by `path`.
|
/// Connects to the socket named by `path`.
|
||||||
///
|
///
|
||||||
/// This function will create a new unix socket and connect to the path
|
/// This function will create a new Unix socket and connect to the path
|
||||||
/// specified, associating the returned stream with the default event loop's
|
/// specified, associating the returned stream with the default event loop's
|
||||||
/// handle.
|
/// handle.
|
||||||
pub fn connect<P>(path: P) -> ConnectFuture
|
pub fn connect<P>(path: P) -> ConnectFuture
|
||||||
@@ -75,7 +75,7 @@ impl UnixStream {
|
|||||||
|
|
||||||
/// Creates an unnamed pair of connected sockets.
|
/// Creates an unnamed pair of connected sockets.
|
||||||
///
|
///
|
||||||
/// This function will create a pair of interconnected unix sockets for
|
/// This function will create a pair of interconnected Unix sockets for
|
||||||
/// communicating back and forth between one another. Each socket will be
|
/// communicating back and forth between one another. Each socket will be
|
||||||
/// associated with the event loop whose handle is also provided.
|
/// associated with the event loop whose handle is also provided.
|
||||||
pub fn pair() -> io::Result<(UnixStream, UnixStream)> {
|
pub fn pair() -> io::Result<(UnixStream, UnixStream)> {
|
||||||
|
|||||||
Reference in New Issue
Block a user