From 5716af09a5abaefdce4b7e973cd9faa37099a7b9 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 17 Jul 2025 17:03:01 +0000 Subject: [PATCH] vhost_user_block: Use Mutex::get_mut() where possible Signed-off-by: Wei Liu --- vhost_user_block/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vhost_user_block/src/lib.rs b/vhost_user_block/src/lib.rs index 040eb1835..5e668c0c5 100644 --- a/vhost_user_block/src/lib.rs +++ b/vhost_user_block/src/lib.rs @@ -334,8 +334,8 @@ impl VhostUserBackendMut for VhostUserBlkBackend { } fn set_event_idx(&mut self, enabled: bool) { - for thread in self.threads.iter() { - thread.lock().unwrap().event_idx = enabled; + for thread in self.threads.iter_mut() { + thread.get_mut().unwrap().event_idx = enabled; } } @@ -352,7 +352,7 @@ impl VhostUserBackendMut for VhostUserBlkBackend { debug!("event received: {:?}", device_event); - let mut thread = self.threads[thread_id].lock().unwrap(); + let thread = self.threads[thread_id].get_mut().unwrap(); match device_event { 0 => { let mut vring = vrings[0].get_mut();