pub trait Process: Send + 'static {
// Required method
fn wakeup(
&mut self,
handle: &RuntimeHandle<'_>,
events: Events<'_>
) -> Result<(), Exit>;
// Provided methods
fn setup(&mut self, _handle: &RuntimeHandle<'_>) -> Result<(), Exit> { ... }
fn shutdown(&mut self) { ... }
}
Expand description
A process that can be run in erin’s Runtime.
Required Methods§
Provided Methods§
sourcefn setup(&mut self, _handle: &RuntimeHandle<'_>) -> Result<(), Exit>
fn setup(&mut self, _handle: &RuntimeHandle<'_>) -> Result<(), Exit>
Called when the process is added to the runtime.
Allows the process to register initial I/O sources and timers. This method should return an error if the process should exit.
The default implementation of this is empty.
sourcefn shutdown(&mut self)
fn shutdown(&mut self)
Called on shutdown.
The process object will be dropped right after this call and can be left in a broken state.
Note that it is not required to deregister I/O sources, the runtime will do that automatically.
This method is not called when [wakeup] or [setup] return an error.
The default implementation of this is empty.