mod sem;
pub use sem::Mutex as SemMutex;
pub struct GuardToken {
}
pub trait Mutex: Sized {
fn new() -> Option<Self>;
fn lock(&self) -> MutexGuard<'_, Self>;
fn try_lock(&self) -> Option<MutexGuard<'_, Self>>;
fn unlock(&self, token: GuardToken);
}
pub struct MutexGuard<'a, T: Mutex> {
mutex: &'a T
}
impl<T: Mutex> Drop for MutexGuard<'_, T> {
fn drop(&mut self) {
self.mutex.unlock(GuardToken {});
}
}