Skip to main content

ProcessManager

Struct ProcessManager 

Source
pub struct ProcessManager { /* private fields */ }
Expand description

Coordinates process spawning, exit observation, and process-wide child reaping.

Implementations§

Source§

impl ProcessManager

Source

pub fn get() -> AgentdResult<Arc<Self>>

Returns the process-wide manager, starting its SIGCHLD thread on first use.

The first call blocks synchronously until the dedicated thread has built its runtime and installed the SIGCHLD listener.

§Errors

Returns an error if the thread, runtime, or signal listener cannot start, or if the process manager has terminated unexpectedly.

Source

pub fn spawn_guard(&self) -> AgentdResult<ProcessSpawnGuard<'_>>

Opens a spawn section that must end by tracking the child PID.

The returned guard serializes the short spawn-to-registration window with reaping. Production exec requests are already spawned serially by the agent loop, so allowing parallel spawns here adds complexity without throughput.

§Errors

Returns an error if the process manager has terminated.

Source

pub fn subscribe_failure(&self) -> AgentdResult<Receiver<Option<String>>>

Subscribes to terminal process-manager failures.

The receiver is created before checking current state so a failure cannot occur between the check and subscription without being observed.

Source

pub fn signal_process_group( &self, identity: ProcessIdentity, signum: i32, ) -> AgentdResult<()>

Signals a tracked process group only while its registration is current.

Holding the state lock across the identity check and kill prevents a reaped PID from being registered to a new session in between them.

Trait Implementations§

Source§

impl Debug for ProcessManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.