Struct runtime_loop::RuntimeLoop
[−]
[src]
pub struct RuntimeLoop { /* fields omitted */ }
Methods
impl RuntimeLoop
[src]
fn new() -> Self
[src]
Constructs a new RuntimeLoop
.
fn get_cancel_flag(&self) -> Arc<AtomicBool>
[src]
Sometimes we want to be able to cancel the loop from the outside. Before we start this loop in its own thread with run(), we can grab the cancel_flag and set it to true.
fn add_pollable(&mut self, pollable: Arc<Mutex<PollableTrait>>)
[src]
The runtime loop will continue to check a list of pollable closures. This is how you add such a closure.
fn run(&self) -> Result<(), String>
[src]
run() will cause a blocking loop and return a result. It is recommended, but unnecessary to call run() by using thread::spawn(...) it can be canceled using the cancel flag. See get_cancel_flag().