Skip to content

Commit 6d7f97c

Browse files
committed
task: Inline first_task variable
1 parent 3912bb5 commit 6d7f97c

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

src/scheduler/task.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -620,27 +620,20 @@ impl BlockedTaskQueue {
620620

621621
// Shall the task automatically be woken up after a certain time?
622622
if let Some(wt) = wakeup_time {
623-
let first_task = true;
624623
let mut cursor = self.list.cursor_front_mut();
625-
let _guard = scopeguard::guard(first_task, |first_task| {
626-
// If the task is the new first task in the list, update the one-shot timer
627-
// to fire when this task shall be woken up.
624+
let _guard = scopeguard::guard((), |_| {
628625
#[cfg(not(feature = "tcp"))]
629-
if first_task {
630-
arch::set_oneshot_timer(wakeup_time);
631-
}
626+
arch::set_oneshot_timer(wakeup_time);
632627
#[cfg(feature = "tcp")]
633-
if first_task {
634-
match self.network_wakeup_time {
635-
Some(time) => {
636-
if time > wt {
637-
arch::set_oneshot_timer(wakeup_time);
638-
} else {
639-
arch::set_oneshot_timer(self.network_wakeup_time);
640-
}
628+
match self.network_wakeup_time {
629+
Some(time) => {
630+
if time > wt {
631+
arch::set_oneshot_timer(wakeup_time);
632+
} else {
633+
arch::set_oneshot_timer(self.network_wakeup_time);
641634
}
642-
_ => arch::set_oneshot_timer(wakeup_time),
643635
}
636+
_ => arch::set_oneshot_timer(wakeup_time),
644637
}
645638
});
646639

0 commit comments

Comments
 (0)