mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-07 15:20:17 +00:00
sys: use Iterator::min instead of a manual version
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
36903bf2fe
commit
6e247b9593
@ -166,24 +166,7 @@ impl ProcessLocker {
|
|||||||
|
|
||||||
/// Get oldest shared lock timestamp
|
/// Get oldest shared lock timestamp
|
||||||
pub fn oldest_shared_lock(locker: Arc<Mutex<Self>>) -> Option<i64> {
|
pub fn oldest_shared_lock(locker: Arc<Mutex<Self>>) -> Option<i64> {
|
||||||
let mut result = None;
|
locker.lock().unwrap().shared_guard_list.values().copied().min()
|
||||||
|
|
||||||
let data = locker.lock().unwrap();
|
|
||||||
|
|
||||||
for v in data.shared_guard_list.values() {
|
|
||||||
result = match result {
|
|
||||||
None => Some(*v),
|
|
||||||
Some(x) => {
|
|
||||||
if x < *v {
|
|
||||||
Some(x)
|
|
||||||
} else {
|
|
||||||
Some(*v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to acquire a exclusive lock
|
/// Try to acquire a exclusive lock
|
||||||
|
Loading…
Reference in New Issue
Block a user