mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-04-25 13:40:43 +02:00
refactor: extract mod exit, task; Thread -> Task
This commit is contained in:
parent
bea88ac58d
commit
dae4d5a140
8 changed files with 114 additions and 74 deletions
10
src/exit.rs
Normal file
10
src/exit.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
use std::sync::{Arc, atomic::AtomicBool};
|
||||
use crate::Usually;
|
||||
|
||||
#[derive(Clone)] pub struct Exit(Arc<AtomicBool>);
|
||||
|
||||
impl Exit {
|
||||
pub fn run <T> (run: impl Fn(Self)->Usually<T>) -> Usually<T> {
|
||||
run(Self(Arc::new(AtomicBool::new(false))))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue