Skip to main content

Module current

Module current 

Source
Expand description

Information about the current thread and current Shuttle execution.

This module provides access to information about the current Shuttle execution. It is useful for building tools that need to exploit Shuttle’s total ordering of concurrent operations; for example, a tool that wants to check linearizability might want access to a global timestamp for events, which the context_switches function provides.

This module also provides functions to manage the assocation of labels to threads and async tasks. Labels are typed values that can be associated with a task. They are useful for debugging: for instance, the TaskName label can be set to assign names to tasks to make debug output easier to read. Labels can also be used to build customized schedulers: for instance, they can be used to assign numeric weights to tasks, which can be used to implement a priority-preemptive scheduler.

Re-exports§

pub use crate::runtime::task::labels::Labels;
pub use crate::runtime::task::ChildLabelFn;
pub use crate::runtime::task::TaskId;
pub use crate::runtime::task::TaskName;
pub use crate::runtime::task::Tag;Deprecated
pub use crate::runtime::task::Taggable;Deprecated

Functions§

clock
Get the current thread’s vector clock
clock_for
Gets the clock for the thread with the given task ID
context_switches
The number of context switches that happened so far in the current Shuttle execution.
get_current_task
Gets the TaskId of the current task, or None if there is no current task.
get_label_for_task
Get a label of the given type for the specified task, if any
get_name_for_task
Get the debug name for a task
get_tag_for_current_taskDeprecated
Gets the tag field of the current task.
get_tag_for_taskDeprecated
Gets the tag field of the specified task.
me
Get the TaskId of the current task. Panics if there is no current task.
remove_label_for_task
Remove a label of the given type for the specified task, returning the old label for the type, if any
reset_step_count
Sets the number of scheduling steps used (wrt. the step bound) to 0.
set_label_for_task
Add the given label to the specified task, returning the old label for the type, if any
set_name_for_task
Set the debug name for a task, returning the old name, if any
set_tag_for_current_taskDeprecated
Sets the tag field of the current task. Returns the tag which was there previously.
set_tag_for_taskDeprecated
Sets the tag field of the specified task.
with_labels_for_task
Apply the given function to the Labels for the specified task