Changed Timer_ to not require clock ownership

This allows to implement timers that can share single clock among them.

This commit is preparation for feature sim time.
This commit is contained in:
Martin Škoudlil 2024-01-08 09:55:21 +01:00
parent db7aa0b6fd
commit 04c24bf47b
1 changed files with 2 additions and 2 deletions

View File

@ -1241,7 +1241,7 @@ impl Node {
let timer = Timer_ { let timer = Timer_ {
timer_handle, timer_handle,
_clock: clock, _clock: Some(clock),
sender: tx, sender: tx,
}; };
self.timers.push(timer); self.timers.push(timer);
@ -1279,7 +1279,7 @@ impl RclTimer {
struct Timer_ { struct Timer_ {
timer_handle: Pin<Box<RclTimer>>, timer_handle: Pin<Box<RclTimer>>,
_clock: Clock, // just here to be dropped properly later. _clock: Option<Clock>, // Some(clock) if the timer owns the clock, just here to be dropped properly later.
sender: mpsc::Sender<Duration>, sender: mpsc::Sender<Duration>,
} }