Skip to content

Commit

Permalink
rust: task: Add wake_up() function
Browse files Browse the repository at this point in the history
Signed-off-by: Boqun Feng <[email protected]>
  • Loading branch information
fbq committed Sep 17, 2021
1 parent 3976bd9 commit 57c2bcf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rust/kernel/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ impl Task {
// SAFETY: By the type invariant, we know that `self.ptr` is non-null and valid.
unsafe { bindings::signal_pending(self.ptr) != 0 }
}

/// Wakes up the task.
pub fn wake_up(&self) {
// SAFETY: By the type invariant, we know that `self.ptr` is non-null and valid.
// And `wake_up_process` is safe to be called for any valid task, even if the task is
// running.
unsafe {
bindings::wake_up_process(self.ptr);
}
}
}

impl PartialEq for Task {
Expand Down

0 comments on commit 57c2bcf

Please sign in to comment.