From 9db2be86633f4ab4d75e6c1b3bbdecc0a99a3ed8 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Tue, 1 Apr 2025 14:07:02 +0200 Subject: [PATCH] Add ContextVerb with Stop and Unstop additionally. --- src/flag.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/flag.rs b/src/flag.rs index 79947c68d5..3f3ddeb4d8 100644 --- a/src/flag.rs +++ b/src/flag.rs @@ -178,8 +178,27 @@ pub enum ContextStatus { Blocked, NotYetStarted, Dead, + Stopped, Other, // reserved } + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[repr(usize)] +pub enum ContextVerb { + Stop = 1, + Unstop = 2, + ForceKill = usize::MAX, +} +impl ContextVerb { + pub fn try_from_raw(raw: usize) -> Option { + Some(match raw { + 1 => Self::Stop, + usize::MAX => Self::ForceKill, + _ => return None, + }) + } +} + // NOT ABI STABLE! #[derive(Clone, Copy, Debug, Eq, PartialEq)] #[repr(u8)]