advance timer state by +1 ms on suspend to avoid double-interrupts on resume

Issue #159 may be caused by queueing a connection to respond to when
the timer expires, but if the timer expires twice then it tries to
respond to a null connection id.

And if it goes to suspend in the same millisecond as it services the
condvar, then it'll reissue the interrupt when it comes back from
suspend.
This commit is contained in:
bunnie 2022-05-21 01:34:35 +08:00
parent 3bfdc238a0
commit ed16fc1b2f

View file

@ -243,7 +243,7 @@ mod implementation {
self.stored_time = Some(
(self.csr.r(utra::susres::TIME0) as u64 |
(self.csr.r(utra::susres::TIME1) as u64) << 32)
+ 0 // a placeholder in case we need to advance time on save
+ 1 // a placeholder in case we need to advance time on save
);
#[cfg(feature = "debugprint")]
println!("Stored time: {}", self.stored_time.unwrap());