contur2
Loading...
Searching...
No Matches
state.h File Reference

ProcessState enum class and validated state transitions. More...

#include <cstdint>
#include <string_view>
Include dependency graph for state.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  contur

Enumerations

enum class  contur::ProcessState : std::uint8_t {
  contur::New , contur::Ready , contur::Running , contur::Blocked ,
  contur::Suspended , contur::Terminated
}
 All possible states in a process lifecycle. More...

Functions

constexpr bool contur::isValidTransition (ProcessState from, ProcessState to) noexcept
 Validates whether a transition from one process state to another is legal.
constexpr std::string_view contur::processStateName (ProcessState state) noexcept
 Returns a human-readable name for the given process state.

Detailed Description

ProcessState enum class and validated state transitions.

Defines all possible states a process can be in during its lifecycle and provides a constexpr validation function for transition legality.

State diagram:

New ──→ Ready ──→ Running ──→ Terminated
↑ │ ↑
│ ▼ │
└─────── Blocked
↑ │
│ ▼
Suspended ←────┘
└──→ Ready

Definition in file state.h.