Struct pausable_clock::PausableClock [−][src]
pub struct PausableClock { /* fields omitted */ }
Expand description
Source of time information that can be paused and resumed. At its heart it is a reference instant in real time, a record of elapsed time, and an atomic state stored in a u64
Implementations
Create a new pausable clock with the given pause state and the given elapsed time
Get the current time according to the clock
Pause the pausable clock. This function will set the pause state to pausing, then to paused. This ensures that no times will be read in the time between when now is read and when the pause state is set that is greater than the paused time.
Note. This method will block synchronously if there are unpausable tasks being run.
True will be returned for a successful pause (meaning the clock wasn’t already paused), and false will be returned if the clock was paused when this method was called.
Resume the pausable clock. This function will set the pause state to resuming, then to resumed.
Note. This method will block synchronously if there are unresumable tasks being run.
True will be returned for a successful resume (meaning the clock wasn’t already resumed), and false will be returned if the clock was resumed when this method was called.
Check to see if the clock is paused using relaxed atomic ordering
Check to see if the clock is pausing using relaxed atomic ordering. Note that a clock that is paused will not be pausing
Check to see if the clock is paused or pausing using relaxed atomic ordering
Block the current thread until the clock resumes. If the clock is not paused when this method is called, the method will return without blocking
Block the current thread until the clock pauses. If the clock is paused when this method is called, the method will return without blocking
This method provides a way to run in coordination with the pause functionality of the clock. A task run with this method will prevent the clock from being paused, and will not be run while the clock is paused
This method provides a way to run in coordination with the pause functionality of the clock. A task run with this method will prevent the clock from being paused, but will not be run if the clock is paused. The turn will contain the result of evaluation of the task if the task is run, and will be None if the task was not run (meaning the clock was paused)
This method provides a way to run in coordination with the resume functionality of the clock. A task run with this method will prevent the clock from being resumed, and will not be run while the clock is resumed
This method provides a way to run in coordination with the resume functionality of the clock. A task run with this method will prevent the clock from being resumed, but will not be run if the clock is not already paused. The turn will contain the result of evaluation of the task if the task is run, and will be None if the task was not run (meaning the clock was running)
Check to see if the clock is paused using the given atomic ordering
Check to see if the clock is pausing using the given atomic ordering. Note that a clock that is paused will not be pausing
Check to see if the clock is paused or pausing using the given atomic ordering
Check to see if the clock is resumed or resuming using the given atomic ordering
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for PausableClock
impl Send for PausableClock
impl Sync for PausableClock
impl Unpin for PausableClock
impl UnwindSafe for PausableClock