pub fn acquire(&self, lock: &mut Lock, who: u64) -> bool {
        let mut acquired_count: usize = 0;
        for &key_hash in &lock.required_hashes[lock.owned_count..] {
            let mut latch = self.lock_latch(key_hash);
            match latch.get_first_req_by_hash(key_hash) {
                Some(cid) => {
                    if cid == who {
                        acquired_count += 1;
                    } else {
                        latch.wait_for_wake(key_hash, who);
                        break;
                    }
                }
                None => {
                    latch.wait_for_wake(key_hash, who);
                    acquired_count += 1;
                }
            }
        }
        lock.owned_count += acquired_count;
        lock.acquired()
    }
/// Tries to acquire the latches specified by the `lock` for command with ID `who`.
///
/// This method will enqueue the command ID into the waiting queues of the latches. A latch is
/// considered acquired if the command ID is the first one of elements in the queue which have
/// the same hash value. Returns true if all the Latches are acquired, false otherwise.
Tries to acquire the latches specified by the `lock` for command with ID `who`.
This method will enqueue the command ID into the waiting queues of the latches. A latch is
considered acquired if the command ID is the first one of elements in the queue which have
the same hash value. Returns true if all the Latches are acquired, false otherwise.
Tries to acquire the latches specified by the ` lock ` for command with ID ` who ` . This method will enqueue the command ID into the waiting queues of the latches . A latch is considered acquired if the command ID is the first one of elements in the queue which have the same hash value . Returns true if all the Latches are acquired false otherwise .
pub fn acquire(&self, lock: &mut Lock, who: u64) -> bool {
        let mut acquired_count: usize = 0;
        for &key_hash in &lock.required_hashes[lock.owned_count..] {
            let mut latch = self.lock_latch(key_hash);
            match latch.get_first_req_by_hash(key_hash) {
                Some(cid) => {
                    if cid == who {
                        acquired_count += 1;
                    } else {
                        latch.wait_for_wake(key_hash, who);
                        break;
                    }
                }
                None => {
                    latch.wait_for_wake(key_hash, who);
                    acquired_count += 1;
                }
            }
        }
        lock.owned_count += acquired_count;
        lock.acquired()
    }
pub fn acquire ( & self , lock : & mut Lock , who : u64 ) -> bool { let mut acquired_count : usize = 0 ; for & key_hash in & lock . required_hashes [ lock . owned_count .. ] { let mut latch = self . lock_latch ( key_hash ) ; match latch . get_first_req_by_hash ( key_hash ) { Some ( cid ) => { if cid == who { acquired_count += 1 ; } else { latch . wait_for_wake ( key_hash , who ) ; break ; } } None => { latch . wait_for_wake ( key_hash , who ) ; acquired_count += 1 ; } } } lock . owned_count += acquired_count ; lock . acquired ( ) }
Tries to acquire the latches specified by the `lock` for command with ID `who`.
Tries to acquire the latches specified by the ` lock ` for command with ID ` who ` .
&self
lock
&mut Lock
who
u64