[−][src]Struct wlambda::threads::MsgHandle
This a messaging handle for providing receiver and sender handles for the inter thread communication of WLambda instances.
The communication is internally done either by RPC or by async message passing. The VVal or WLambda values are serialized as msgpack internally for transmission to the other thread. This is not a high speed interface, as serialization and allocations are done.
The communication between WLambda thread instances can be done by multiple senders and multiple receivers, but bear in mind, that in case of RPC one RPC call will lock out all other sender and receiver thread, as RPC calls are synchronous.
Pass this MsgHandle to the receiver thread or multiple threads. You can clone this handle if you want to use it in multiple threads.
See also threads module
Methods
impl MsgHandle[src]
pub fn new() -> Self[src]
pub fn sender(&self) -> Sender[src]
Returns a Sender handle.
pub fn run(&mut self, ctx: &mut EvalContext)[src]
Starts executing Sender requests infinitely long.
A global thread:quit function is defined, which can be used
to stop this infinitely long loop.
pub fn step(&mut self, ctx: &mut EvalContext, timeout: &Duration) -> Option<()>[src]
Tries to execute a RPC call or received message if the request is
received within timeout duration. Returns None if something
went wrong. Otherwise Some(()) is returned.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for MsgHandle
impl Send for MsgHandle
impl Sync for MsgHandle
impl Unpin for MsgHandle
impl !UnwindSafe for MsgHandle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,