Skip to content

Commit

Permalink
disable network interrupts in polling mode
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Aug 3, 2023
1 parent 850f267 commit 8f36730
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/executor/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ where
// be sure that we are not interrupted by a timer, which is able
// to call `reschedule`
without_interrupts(|| {
// avoid network interrupts
get_network_driver().unwrap().lock().set_polling_mode(true);

let start = now();
let waker = core::task::Waker::noop();
let mut cx = Context::from_waker(&waker);
Expand All @@ -349,6 +352,9 @@ where
.map(|d| crate::arch::processor::get_timer_ticks() + d.total_micros());
core_scheduler().add_network_timer(wakeup_time);

// allow network interrupts
get_network_driver().unwrap().lock().set_polling_mode(false);

return t;
}

Expand All @@ -358,6 +364,9 @@ where
.map(|d| crate::arch::processor::get_timer_ticks() + d.total_micros());
core_scheduler().add_network_timer(wakeup_time);

// allow network interrupts
get_network_driver().unwrap().lock().set_polling_mode(false);

return Err(-crate::errno::ETIME);
}
}
Expand Down

0 comments on commit 8f36730

Please sign in to comment.