<JamesMunns[m]> "That'd just be an atomic Mutex..." <- I've written that a lot, but I don't have a crate for it. It's basically just:

```rust
struct Mutex<T> {
    lock: AtomicBool,
    data: UnsafeCell<T>,
}

impl Mutex<T> {
    const fn new(data: T) -> Self {
        Self { lock: AtomicBool::new(false), data, }
    }

    fn lock(&self) -> Guard<'_, T> {
        if self.lock.swap(false, AcqRel) {
            panic!();
        }
        Guard { ref: self }
    }
}

struct Guard<'a, T> {
    ref: &'a Mutex<T>,
}

impl<'a, T> Drop for Guard<'a, T> {
    fn drop(&mut self) {
        self.ref.lock.store(false, Release);
    }
}

impl<'a, T> Deref for Guard<'a, T> {
    // make sure you return a '_ ref not a 'a ref
}

impl<'a, T> DerefMut for Guard<'a, T> {
    // same
}
```