pub struct MonitorRegistry { /* private fields */ }Expand description
Registry for process links and monitors.
Thread-safe via DashMap. Delivers exit signals when processes
terminate.
Implementations§
Source§impl MonitorRegistry
impl MonitorRegistry
Sourcepub fn link(&self, pid_a: Pid, pid_b: Pid)
pub fn link(&self, pid_a: Pid, pid_b: Pid)
Create a bidirectional link between two processes.
If the link already exists, this is a no-op.
Sourcepub fn unlink(&self, pid_a: Pid, pid_b: Pid)
pub fn unlink(&self, pid_a: Pid, pid_b: Pid)
Remove a bidirectional link between two processes.
Sourcepub fn monitor(&self, watcher: Pid, target: Pid) -> String
pub fn monitor(&self, watcher: Pid, target: Pid) -> String
Create a unidirectional monitor: watcher monitors target.
Returns a unique reference ID that can be used to demonitor.
Sourcepub fn process_exited(
&self,
pid: Pid,
reason: &ExitReason,
) -> (Vec<(Pid, ExitReason)>, Vec<ProcessDown>)
pub fn process_exited( &self, pid: Pid, reason: &ExitReason, ) -> (Vec<(Pid, ExitReason)>, Vec<ProcessDown>)
Called when a process exits. Returns the set of signals to deliver:
(linked_pid, ExitReason)for each linked processProcessDownfor each monitoring process
Sourcepub fn get_monitors(&self, pid: Pid) -> Vec<ProcessMonitor>
pub fn get_monitors(&self, pid: Pid) -> Vec<ProcessMonitor>
Get all monitors watching the given PID.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MonitorRegistry
impl !RefUnwindSafe for MonitorRegistry
impl Send for MonitorRegistry
impl Sync for MonitorRegistry
impl Unpin for MonitorRegistry
impl UnsafeUnpin for MonitorRegistry
impl UnwindSafe for MonitorRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more