apprentice/src/task_state.rs

41 lines
1.2 KiB
Rust
Raw Normal View History

/// The different states a Task can go through during its lifetime.
pub enum TaskState
{
/// The state that every Task starts in.
///
/// The STARTING state can only lead to the processing state.
Starting,
/// The state that each Task is in while it is actually
/// being process and running on a thread.
///
/// The PROCESSING state can only lead to WAITING,
/// FINISHED, or UNKNOWN states.
Processing,
/// The state a Task is in while it is waiting for child
/// tasks to switch to the FINISHED state.
///
/// The WAITING state can only lead to the DONE_WAITING
/// and UNKNOWN states.
Waiting,
/// The state a Task is in once it is done processing
/// child tasks, but prior to going back to the PROCESSING state.
///
/// The DONE_WAITING state can only lead to the PROCESSING
/// and UNKNOWN states.
DoneWaiting,
/// The state a Task will be in when it is FINISHED processing
/// and ready to be destroyed.
///
/// The FINISHED state cannot lead to any states and shows that the
/// task is completed.
Finished,
/// The state a Task will be placed in if it is detected to be
/// in an inproper state during its lifetime.
Unknown
}