vhost_user_block: Use Mutex::get_mut() where possible

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu
2025-07-17 17:03:01 +00:00
committed by Wei Liu
parent 4ea40b4bea
commit 5716af09a5

View File

@@ -334,8 +334,8 @@ impl VhostUserBackendMut for VhostUserBlkBackend {
} }
fn set_event_idx(&mut self, enabled: bool) { fn set_event_idx(&mut self, enabled: bool) {
for thread in self.threads.iter() { for thread in self.threads.iter_mut() {
thread.lock().unwrap().event_idx = enabled; thread.get_mut().unwrap().event_idx = enabled;
} }
} }
@@ -352,7 +352,7 @@ impl VhostUserBackendMut for VhostUserBlkBackend {
debug!("event received: {:?}", device_event); 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 { match device_event {
0 => { 0 => {
let mut vring = vrings[0].get_mut(); let mut vring = vrings[0].get_mut();