diff options
author | Carl Lerche <me@carllerche.com> | 2019-12-22 12:55:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-22 12:55:09 -0800 |
commit | 7b53b7b659fe1feeb30e768cad8fdadf9531beb6 (patch) | |
tree | ce4020f1e63ee9ecaa822ccd9961de6542bb91c3 /tokio/src/park | |
parent | 99fa93bf0ea504413f6e53b46fbefdee4c0a0904 (diff) |
doc: fill out `fs` and remove html links (#2015)
also add an async version of `fs::canonicalize`
Diffstat (limited to 'tokio/src/park')
-rw-r--r-- | tokio/src/park/mod.rs | 69 | ||||
-rw-r--r-- | tokio/src/park/thread.rs | 4 |
2 files changed, 20 insertions, 53 deletions
diff --git a/tokio/src/park/mod.rs b/tokio/src/park/mod.rs index e6b0c72b..9c1958c3 100644 --- a/tokio/src/park/mod.rs +++ b/tokio/src/park/mod.rs @@ -1,48 +1,38 @@ //! Abstraction over blocking and unblocking the current thread. //! //! Provides an abstraction over blocking the current thread. This is similar to -//! the park / unpark constructs provided by [`std`] but made generic. This -//! allows embedding custom functionality to perform when the thread is blocked. +//! the park / unpark constructs provided by `std` but made generic. This allows +//! embedding custom functionality to perform when the thread is blocked. //! -//! A blocked [`Park`][p] instance is unblocked by calling [`unpark`] on its -//! [`Unpark`][up] handle. +//! A blocked `Park` instance is unblocked by calling `unpark` on its +//! `Unpark` handle. //! -//! The [`ParkThread`] struct implements [`Park`][p] using -//! [`thread::park`][`std`] to put the thread to sleep. The Tokio reactor also -//! implements park, but uses [`mio::Poll`][mio] to block the thread instead. +//! The `ParkThread` struct implements `Park` using `thread::park` to put the +//! thread to sleep. The Tokio reactor also implements park, but uses +//! `mio::Poll` to block the thread instead. //! -//! The [`Park`][p] trait is composable. A timer implementation might decorate a -//! [`Park`][p] implementation by checking if any timeouts have elapsed after -//! the inner [`Park`][p] implementation unblocks. +//! The `Park` trait is composable. A timer implementation might decorate a +//! `Park` implementation by checking if any timeouts have elapsed after the +//! inner `Park` implementation unblocks. //! //! # Model //! -//! Conceptually, each [`Park`][p] instance has an associated token, which is +//! Conceptually, each `Park` instance has an associated token, which is //! initially not present: //! -//! * The [`park`] method blocks the current thread unless or until the token -//! is available, at which point it atomically consumes the token. -//! * The [`unpark`] method atomically makes the token available if it wasn't +//! * The `park` method blocks the current thread unless or until the token is +//! available, at which point it atomically consumes the token. +//! * The `unpark` method atomically makes the token available if it wasn't //! already. //! //! Some things to note: //! -//! * If [`unpark`] is called before [`park`], the next call to [`park`] will +//! * If `unpark` is called before `park`, the next call to `park` will //! **not** block the thread. -//! * **Spurious** wakeups are permitted, i.e., the [`park`] method may unblock -//! even if [`unpark`] was not called. -//! * [`park_timeout`] does the same as [`park`] but allows specifying a maximum +//! * **Spurious** wakeups are permitted, i.e., the `park` method may unblock +//! even if `unpark` was not called. +//! * `park_timeout` does the same as `park` but allows specifying a maximum //! time to block the thread for. -//! -//! [`std`]: https://doc.rust-lang.org/std/thread/fn.park.html -//! [`thread::park`]: https://doc.rust-lang.org/std/thread/fn.park.html -//! [`ParkThread`]: struct.ParkThread.html -//! [p]: trait.Park.html -//! [`park`]: trait.Park.html#tymethod.park -//! [`park_timeout`]: trait.Park.html#tymethod.park_timeout -//! [`unpark`]: trait.Unpark.html#tymethod.unpark -//! [up]: trait.Unpark.html -//! [mio]: https://docs.rs/mio/0.6/mio/struct.Poll.html cfg_resource_drivers! { mod either; @@ -60,10 +50,6 @@ use std::sync::Arc; use std::time::Duration; /// Block the current thread. -/// -/// See [module documentation][mod] for more details. -/// -/// [mod]: ../index.html pub(crate) trait Park { /// Unpark handle type for the `Park` implementation. type Unpark: Unpark; @@ -80,15 +66,11 @@ pub(crate) trait Park { /// forever, and callers should be prepared for this possibility. This /// function may wakeup spuriously for any reason. /// - /// See [module documentation][mod] for more details. - /// /// # Panics /// /// This function **should** not panic, but ultimately, panics are left as /// an implementation detail. Refer to the documentation for the specific /// `Park` implementation - /// - /// [mod]: ../index.html fn park(&mut self) -> Result<(), Self::Error>; /// Park the current thread for at most `duration`. @@ -100,39 +82,26 @@ pub(crate) trait Park { /// blocked for any amount of time. Spurious wakeups are permitted for any /// reason. /// - /// See [module documentation][mod] for more details. - /// /// # Panics /// /// This function **should** not panic, but ultimately, panics are left as /// an implementation detail. Refer to the documentation for the specific /// `Park` implementation - /// - /// [mod]: ../index.html fn park_timeout(&mut self, duration: Duration) -> Result<(), Self::Error>; } -/// Unblock a thread blocked by the associated [`Park`] instance. -/// -/// See [module documentation][mod] for more details. -/// -/// [mod]: ../index.html -/// [`Park`]: trait.Park.html +/// Unblock a thread blocked by the associated `Park` instance. pub(crate) trait Unpark: Sync + Send + 'static { /// Unblock a thread that is blocked by the associated `Park` handle. /// /// Calling `unpark` atomically makes available the unpark token, if it is /// not already available. /// - /// See [module documentation][mod] for more details. - /// /// # Panics /// /// This function **should** not panic, but ultimately, panics are left as /// an implementation detail. Refer to the documentation for the specific /// `Unpark` implementation - /// - /// [mod]: ../index.html fn unpark(&self); } diff --git a/tokio/src/park/thread.rs b/tokio/src/park/thread.rs index 894e5301..59513e1d 100644 --- a/tokio/src/park/thread.rs +++ b/tokio/src/park/thread.rs @@ -10,11 +10,9 @@ pub(crate) struct ParkThread { inner: Arc<Inner>, } -/// Error returned by [`ParkThread`] +/// Error returned by `ParkThread` /// /// This currently is never returned, but might at some point in the future. -/// -/// [`ParkThread`]: struct.ParkThread.html #[derive(Debug)] pub(crate) struct ParkError { _p: (), |