use a read guard instead of write

This commit is contained in:
teoxoy 2024-07-02 20:42:41 +02:00 committed by Teodor Tanasoaia
parent eb0eb342cf
commit ef7d27233e

View File

@ -259,12 +259,9 @@ impl Global {
) -> Result<(), WaitIdleError> {
let hub = A::hub(self);
let last_submission = {
let buffer_guard = hub.buffers.write();
match buffer_guard.get(buffer_id) {
Ok(buffer) => buffer.submission_index(),
Err(_) => return Ok(()),
}
let last_submission = match hub.buffers.read().get(buffer_id) {
Ok(buffer) => buffer.submission_index(),
Err(_) => return Ok(()),
};
hub.devices