An open API service indexing awesome lists of open source software.

https://github.com/urholaukkarinen/notify-thread

A simple wrapper for notifying threads
https://github.com/urholaukkarinen/notify-thread

Last synced: 27 days ago
JSON representation

A simple wrapper for notifying threads

Awesome Lists containing this project

README

        

# notify-thread

A simple wrapper for threads that allows you to notify the thread that something has happened.

```rust
fn main() {
// Spawn a new thread that waits until notified
let join_handle = easy_thread::spawn(|ctx| {
while !ctx.notified() {
println!("Looping");

std::thread::sleep(std::time::Duration::from_millis(100));
}
});

std::thread::sleep(std::time::Duration::from_millis(1000));

// Notify the thread
join_handle.notify();

join_handle.join().unwrap();
}
```