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

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