Skip to main content

radiate_core/domain/sync/
mod.rs

1mod channel;
2mod control;
3mod group;
4mod thread_pool;
5
6use std::sync::Arc;
7
8pub use channel::{CommandChannel, IntoPair};
9pub use control::ThreadSync;
10pub use group::{WaitGroup, WaitGuard};
11pub use thread_pool::{WorkResult, get_thread_pool};
12
13pub trait ArcExt<T> {
14    fn pair(value: T) -> (Arc<T>, Arc<T>) {
15        let arc = Arc::new(value);
16        (Arc::clone(&arc), arc)
17    }
18
19    fn into_pair(self) -> (Arc<T>, Arc<T>);
20}
21
22impl<T> ArcExt<T> for Arc<T> {
23    fn into_pair(self) -> (Arc<T>, Arc<T>) {
24        (Arc::clone(&self), self)
25    }
26}