Skip to content

Commit

Permalink
Added docs for suspending.
Browse files Browse the repository at this point in the history
  • Loading branch information
SSheldon committed Aug 22, 2015
1 parent 9f7499b commit 8407505
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ impl Queue {
}
}

/// Suspends the invocation of blocks on self and returns a `SuspendGuard`
/// that can be dropped to resume.
///
/// The suspension occurs after completion of any blocks running at the
/// time of the call.
/// Invocation does not resume until all `SuspendGuard`s have been dropped.
pub fn suspend(&self) -> SuspendGuard {
SuspendGuard::new(self)
}
Expand All @@ -329,6 +335,7 @@ impl Drop for Queue {
}
}

/// An RAII guard which will resume a suspended `Queue` when dropped.
pub struct SuspendGuard {
queue: Queue,
}
Expand All @@ -341,6 +348,7 @@ impl SuspendGuard {
SuspendGuard { queue: queue.clone() }
}

/// Drops self, allowing the suspended `Queue` to resume.
pub fn resume(self) { }
}

Expand Down

0 comments on commit 8407505

Please sign in to comment.