Fix typos in thread::park documentation.

This commit is contained in:
Felix Raimundo
2017-05-07 21:43:46 +02:00
parent fa0cdaa63f
commit 03c9510525

View File

@@ -518,7 +518,7 @@ pub fn sleep(dur: Duration) {
/// # park and unpark /// # park and unpark
/// ///
/// Every thread is equipped with some basic low-level blocking support, via the /// Every thread is equipped with some basic low-level blocking support, via the
/// [`thread::park`][`park`] function and [`thread::Thread::unpark()`][`unpark`] /// [`thread::park`][`park`] function and [`thread::Thread::unpark`][`unpark`]
/// method. [`park`] blocks the current thread, which can then be resumed from /// method. [`park`] blocks the current thread, which can then be resumed from
/// another thread by calling the [`unpark`] method on the blocked thread's /// another thread by calling the [`unpark`] method on the blocked thread's
/// handle. /// handle.
@@ -555,6 +555,7 @@ pub fn sleep(dur: Duration) {
/// ///
/// ``` /// ```
/// use std::thread; /// use std::thread;
/// use std::time::Duration;
/// ///
/// let parked_thread = thread::Builder::new() /// let parked_thread = thread::Builder::new()
/// .spawn(|| { /// .spawn(|| {
@@ -598,7 +599,7 @@ pub fn park() {
/// Blocks unless or until the current thread's token is made available or /// Blocks unless or until the current thread's token is made available or
/// the specified duration has been reached (may wake spuriously). /// the specified duration has been reached (may wake spuriously).
/// ///
/// The semantics of this function are equivalent to [`park()`][park] except /// The semantics of this function are equivalent to [`park`][park] except
/// that the thread will be blocked for roughly no longer than `dur`. This /// that the thread will be blocked for roughly no longer than `dur`. This
/// method should not be used for precise timing due to anomalies such as /// method should not be used for precise timing due to anomalies such as
/// preemption or platform differences that may not cause the maximum /// preemption or platform differences that may not cause the maximum
@@ -617,7 +618,7 @@ pub fn park_timeout_ms(ms: u32) {
/// Blocks unless or until the current thread's token is made available or /// Blocks unless or until the current thread's token is made available or
/// the specified duration has been reached (may wake spuriously). /// the specified duration has been reached (may wake spuriously).
/// ///
/// The semantics of this function are equivalent to [`park()`][park] except /// The semantics of this function are equivalent to [`park`][park] except
/// that the thread will be blocked for roughly no longer than `dur`. This /// that the thread will be blocked for roughly no longer than `dur`. This
/// method should not be used for precise timing due to anomalies such as /// method should not be used for precise timing due to anomalies such as
/// preemption or platform differences that may not cause the maximum /// preemption or platform differences that may not cause the maximum
@@ -780,7 +781,7 @@ impl Thread {
/// Atomically makes the handle's token available if it is not already. /// Atomically makes the handle's token available if it is not already.
/// ///
/// Every thread is equipped with some basic low-level blocking support, via /// Every thread is equipped with some basic low-level blocking support, via
/// the [`park()`][park] function and the `unpark()` method. These can be /// the [`park`][park] function and the `unpark()` method. These can be
/// used as a more CPU-efficient implementation of a spinlock. /// used as a more CPU-efficient implementation of a spinlock.
/// ///
/// See the [park documentation][park] for more details. /// See the [park documentation][park] for more details.
@@ -789,6 +790,7 @@ impl Thread {
/// ///
/// ``` /// ```
/// use std::thread; /// use std::thread;
/// use std::time::Duration;
/// ///
/// let parked_thread = thread::Builder::new() /// let parked_thread = thread::Builder::new()
/// .spawn(|| { /// .spawn(|| {