Crates.io | thread-control |
lib.rs | thread-control |
version | 0.1.2 |
source | src |
created_at | 2016-09-21 13:05:18.508514 |
updated_at | 2017-04-27 09:35:18.399294 |
description | Rust library to control threads' execution/status. |
homepage | |
repository | https://github.com/DenisKolodin/thread-control |
max_upload_size | |
id | 6570 |
size | 17,110 |
Missing Rust features to control threads execution.
Example:
use std::thread;
use thread_control::*;
fn main() {
let (flag, control) = make_pair();
let handle = thread::spawn(move || {
while flag.alive() {
}
});
assert_eq!(control.is_done(), false);
control.stop(); // Also you can `control.interrupt()` it
handle.join();
assert_eq!(control.is_interrupted(), false);
assert_eq!(control.is_done(), true);
}
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.