Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
PeizhongQiu committed Dec 12, 2024
1 parent b1542f2 commit fb1bf87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ mod timer;

pub use config::AxVmDeviceConfig;
pub use device::AxVmDevices;
pub use timer::AxVmTimer;
pub use timer::AxVmTimer;
8 changes: 4 additions & 4 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use core::sync::atomic::Ordering;

static TOKEN: AtomicUsize = AtomicUsize::new(0);


struct VmmTimerEvent {
token: usize,
timer_callback: Box<dyn FnOnce(TimeValue) + Send + 'static>,
Expand All @@ -27,7 +26,7 @@ impl VmmTimerEvent {
}

impl TimerEvent for VmmTimerEvent {
fn callback(self, now: TimeValue) {
fn callback(self, now: TimeValue) {
(self.timer_callback)(now)
}
}
Expand Down Expand Up @@ -58,7 +57,8 @@ impl AxVmTimer {
{
let token = TOKEN.fetch_add(1, Ordering::Release);
let event = VmmTimerEvent::new(token, handler);
self.timer_list.set(TimeValue::from_nanos(deadline as u64), event);
self.timer_list
.set(TimeValue::from_nanos(deadline as u64), event);
token
}

Expand Down Expand Up @@ -90,7 +90,7 @@ impl AxVmTimer {
/// # Returns
/// `true` if an event was handled (i.e., a timer expired and its callback was executed),
/// or `false` if no timers were expired.
pub fn check_events(&mut self, now: TimeValue) -> bool {
pub fn check_event(&mut self, now: TimeValue) -> bool {
let event = self.timer_list.expire_one(now);
if let Some((_deadline, event)) = event {
error!("pick one {:#?} to handler!!!", _deadline);
Expand Down

0 comments on commit fb1bf87

Please sign in to comment.