fn lock_exclusive(&self) {
        match &self.shared {
            Some(shared) => {
                // Early return if possible - Instant::now is not necessarily cheap
                if self.try_lock_exclusive() {
                    return;
                }

                let now = std::time::Instant::now();
                self.inner.lock_exclusive();
                let elapsed = now.elapsed().as_nanos() as u64;
                shared.exclusive_count.fetch_add(1, Ordering::Relaxed);
                shared
                    .exclusive_wait_nanos
                    .fetch_add(elapsed, Ordering::Relaxed);
            }
            None => self.inner.lock_exclusive(),
        }
    }
/// Acquires an exclusive lock, blocking the current thread until it is able to do so.
Acquires an exclusive lock, blocking the current thread until it is able to do so.
Acquires an exclusive lock blocking the current thread until it is able to do so .
fn lock_exclusive(&self) {
        match &self.shared {
            Some(shared) => {
                // Early return if possible - Instant::now is not necessarily cheap
                if self.try_lock_exclusive() {
                    return;
                }
                let now = std::time::Instant::now();
                self.inner.lock_exclusive();
                let elapsed = now.elapsed().as_nanos() as u64;
                shared.exclusive_count.fetch_add(1, Ordering::Relaxed);
                shared
                    .exclusive_wait_nanos
                    .fetch_add(elapsed, Ordering::Relaxed);
            }
            None => self.inner.lock_exclusive(),
        }
    }
fn lock_exclusive ( & self ) { match & self . shared { Some ( shared ) => { // Early return if possible - Instant::now is not necessarily cheap if self . try_lock_exclusive ( ) { return ; } let now = std :: time :: Instant :: now ( ) ; self . inner . lock_exclusive ( ) ; let elapsed = now . elapsed ( ) . as_nanos ( ) as u64 ; shared . exclusive_count . fetch_add ( 1 , Ordering :: Relaxed ) ; shared . exclusive_wait_nanos . fetch_add ( elapsed , Ordering :: Relaxed ) ; } None => self . inner . lock_exclusive ( ) , } }
Acquires an exclusive lock, blocking the current thread until it is able to do so.
Acquires an exclusive lock blocking the current thread until it is able to do so .
&self
&self