scanner(2)

Signed-off-by: mujunxiang <1948535941@qq.com>
This commit is contained in:
mujunxiang
2024-12-03 17:05:23 +08:00
committed by weisd
parent a7a2ae2781
commit 9533e312b1
4 changed files with 54 additions and 42 deletions
+3 -2
View File
@@ -2,6 +2,7 @@ use std::time::{Duration, Instant};
use rand::Rng;
use tokio::{sync::RwLock, time::sleep};
use tracing::info;
#[derive(Debug, Default)]
pub struct LRWMutex {
@@ -87,14 +88,14 @@ impl LRWMutex {
pub async fn un_lock(&self) {
let is_write = true;
if !self.unlock(is_write).await {
panic!("Trying to un_lock() while no Lock() is active")
info!("Trying to un_lock() while no Lock() is active")
}
}
pub async fn un_r_lock(&self) {
let is_write = false;
if !self.unlock(is_write).await {
panic!("Trying to un_r_lock() while no Lock() is active")
info!("Trying to un_r_lock() while no Lock() is active")
}
}