mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
add assert around sleep_heap() discipline in ticktimer
Every entry into the sleep_heap() should be unique. Any insert() call that returns a value means we're going to drop a wake-up event. Add an assert()! that will trigger a panic if this invariant is not met.
This commit is contained in:
parent
bc18c7e629
commit
d457f8b555
3 changed files with 6 additions and 6 deletions
|
|
@ -306,7 +306,7 @@ impl XousTickTimer {
|
|||
if let Some(current) = self.stop_interrupt() {
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("Existing request was {:?}", current);
|
||||
sleep_heap.insert(current.msec, current);
|
||||
assert!(sleep_heap.insert(current.msec, current).is_none(), "Existing sleep_heap entry would be overwritten");
|
||||
} else {
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("There was no existing sleep() request");
|
||||
|
|
@ -363,7 +363,7 @@ impl XousTickTimer {
|
|||
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("Modified, the request was: {:?}", request);
|
||||
sleep_heap.insert(request.msec, request);
|
||||
assert!(sleep_heap.insert(request.msec, request).is_none(), "Existing sleep_heap entry would be overwritten");
|
||||
} else {
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("No new sleep request");
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ impl XousTickTimer {
|
|||
if let Some(current) = self.stop_interrupt() {
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("Existing request was {:?}", current);
|
||||
sleep_heap.insert(current.msec, current);
|
||||
assert!(sleep_heap.insert(current.msec, current).is_none(), "Existing sleep_heap entry would be overwritten");
|
||||
} else {
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("There was no existing sleep() request");
|
||||
|
|
@ -231,7 +231,7 @@ impl XousTickTimer {
|
|||
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("Modified, the request was: {:?}", request);
|
||||
sleep_heap.insert(request.msec, request);
|
||||
assert!(sleep_heap.insert(request.msec, request).is_none(), "Existing sleep_heap entry would be overwritten");
|
||||
} else {
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("No new sleep request");
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ impl XousTickTimer {
|
|||
if let Some(current) = self.stop_interrupt() {
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("Existing request was {:?}", current);
|
||||
sleep_heap.insert(current.msec, current);
|
||||
assert!(sleep_heap.insert(current.msec, current).is_none(), "Existing sleep_heap entry would be overwritten");
|
||||
} else {
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("There was no existing sleep() request");
|
||||
|
|
@ -344,7 +344,7 @@ impl XousTickTimer {
|
|||
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("Modified, the request was: {:?}", request);
|
||||
sleep_heap.insert(request.msec, request);
|
||||
assert!(sleep_heap.insert(request.msec, request).is_none(), "Existing sleep_heap entry would be overwritten");
|
||||
} else {
|
||||
#[cfg(feature = "debug-print")]
|
||||
log::info!("No new sleep request");
|
||||
|
|
|
|||
Loading…
Reference in a new issue