Crates.io | tetsy-exit-future |
lib.rs | tetsy-exit-future |
version | 0.2.0 |
source | src |
created_at | 2021-02-24 06:56:47.533175 |
updated_at | 2021-02-24 06:56:47.533175 |
description | Tetsy Future that signals exit to many receivers |
homepage | |
repository | https://github.com/tetcoin/tetsy-exit-future |
max_upload_size | |
id | 359832 |
size | 5,810 |
Create a Signal
and cloneable Exit
future that fires when Signal
is fired or dropped.
Used to coordinate exit between multiple event-loop threads.
let (signal, exit) = tetsy_exit_future::signal();
::std::thread::spawn(move || {
// future resolves when signal fires
exit.wait();
});
let _ = signal.fire(); // also would fire on drop.