Skip to content

Commit

Permalink
Reset the read cursor on timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
aMarcireau committed Dec 7, 2023
1 parent 4f43a6b commit 2a0dc87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = [
"Alexandre Marcireau",
]
description = "Neuromorphic devices drivers"
version = "0.10.0"
version = "0.10.1"
edition = "2021"
license-file = "../LICENSE"
homepage = "https://github.com/neuromorphicsystems/neuromorphic-rs/"
Expand Down
3 changes: 2 additions & 1 deletion drivers/src/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,13 +710,14 @@ impl Ring {
if ellapsed >= *duration {
self.active_buffer_view
.store(false, std::sync::atomic::Ordering::Release);
shared.read = (shared.read + shared.buffers.len() - 1) % shared.buffers.len();
return None;
}
shared = self
.context
.shared_condvar
.wait_timeout(shared, *duration - ellapsed)
.expect("shared_condar used with two different mutexes")
.expect("shared_condvar used with two different mutexes")
.0;
}
if shared.buffers[shared.read].length > 0 {
Expand Down

0 comments on commit 2a0dc87

Please sign in to comment.