summaryrefslogtreecommitdiffstats
path: root/src/mutex.rs
blob: 51192a872f5572b843e76dfa7b8b51be2b237ffa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
pub type Mutex<T> = async_std::sync::Arc<async_std::sync::Mutex<T>>;

pub fn new<T>(t: T) -> async_std::sync::Arc<async_std::sync::Mutex<T>> {
    async_std::sync::Arc::new(async_std::sync::Mutex::new(t))
}

pub fn unwrap<T: std::fmt::Debug>(t: Mutex<T>) -> T {
    async_std::sync::Mutex::into_inner(
        async_std::sync::Arc::try_unwrap(t).unwrap(),
    )
}