Skip to content

Commit

Permalink
Add comments for preempt_resched
Browse files Browse the repository at this point in the history
  • Loading branch information
hky1999 committed Oct 14, 2024
1 parent e68b461 commit e6997d1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/axtask/src/run_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ impl<'a, G: BaseGuard> AxRunQueueRef<'a, G> {
.set_priority(crate::current().as_task_ref(), prio)
}

/// Preepts the current task and reschedule.
/// This function is used to preempt the current task and reschedule
/// to next task on current run queue.
///
/// This function is called by `current_check_preempt_pending` with IRQs and preemption disabled.
///
/// Note:
/// preemption may happened in `enable_preempt`, which is called
/// each time a [`kspin::NoPreemptGuard`] is dropped.
#[cfg(feature = "preempt")]
pub fn preempt_resched(&mut self) {
// There is no need to disable IRQ and preemption here, because
Expand Down

0 comments on commit e6997d1

Please sign in to comment.