Checking this in before I pull the thread code out to its own file.

This commit is contained in:
Jason Travis Smith
2016-03-25 02:45:34 -04:00
parent b83c3970a6
commit 01f9b49498
13 changed files with 862 additions and 31 deletions

40
src/task_state.rs Normal file
View File

@ -0,0 +1,40 @@
/// 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
}