Crates.io | wait_notify |
lib.rs | wait_notify |
version | 0.1.0 |
source | src |
created_at | 2024-07-11 01:43:24.712549 |
updated_at | 2024-07-11 01:43:24.712549 |
description | a synchronization primitive for Rust that provides basic wait and notify functionality |
homepage | https://github.com/nnsgmsone |
repository | https://github.com/nnsgmsone/wait_notify |
max_upload_size | |
id | 1298976 |
size | 39,026 |
wait_notify
is a simple synchronization primitive for Rust that provides basic wait and notify functionality. It is similar to WaitGroup
, but with only wait
and notify
functions.
use wait_notify::WaitNotify;
use std::thread;
let wn = WaitNotify::default();
let wn_clone = wn.clone();
let handle = thread::spawn(move || {
// do some work
wn_clone.wait();
// do some work
});
// do some work
wn.notify();
// do some work
handle.join().unwrap();
wait_notify
source code is available under the GPL License.