pub struct System {
pub undeliverable: Vec<(Pid, Value)>,
/* private fields */
}Expand description
The host state a blue process tree runs against.
Mailboxes live here rather than on the crate::Supervisor on purpose:
the supervisor owns the processes and hands &mut H to Vm::step, so a
supervisor-owned mailbox map would be borrowed twice at once.
Fields§
§undeliverable: Vec<(Pid, Value)>Sends to a pid with no mailbox. Kept rather than dropped so a misdirected message is diagnosable instead of invisible.
Implementations§
Source§impl System
impl System
pub fn new() -> Self
pub fn current(&self) -> Pid
Sourcepub fn send(&mut self, to: Pid, msg: Value)
pub fn send(&mut self, to: Pid, msg: Value)
Enqueue a deep copy of msg.
Value is Arc-based, so pushing it as-is would share structure
between two processes and quietly reintroduce exactly the coupling that
separate interpreters removed. Copying at the boundary is what makes
“processes share nothing” true rather than nearly true.
pub fn has_mail(&self, pid: Pid) -> bool
pub fn mail_count(&self, pid: Pid) -> usize
Trait Implementations§
Source§impl Readiness for System
impl Readiness for System
Source§fn any_pending(&self) -> bool
fn any_pending(&self) -> bool
Is there any pending work at all? When every process is parked and
this is false, nothing will ever change: that is a deadlock, and
spinning on it forever is the failure mode this question exists to
prevent.
Source§fn set_current(&mut self, pid: Pid)
fn set_current(&mut self, pid: Pid)
The scheduler is about to give
pid a slice. A host whose primitives
are process-relative — receive, self — needs this to answer them.
Default: nothing.Source§fn on_restart(&mut self, pid: Pid)
fn on_restart(&mut self, pid: Pid)
pid is about to restart, so its per-process host state should be
discarded. Default: nothing.Auto Trait Implementations§
impl !RefUnwindSafe for System
impl !UnwindSafe for System
impl Freeze for System
impl Send for System
impl Sync for System
impl Unpin for System
impl UnsafeUnpin for System
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