Skip to content

Commit 57c2bcf

Browse files
committed
rust: task: Add wake_up() function
Signed-off-by: Boqun Feng <[email protected]>
1 parent 3976bd9 commit 57c2bcf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

rust/kernel/task.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ impl Task {
108108
// SAFETY: By the type invariant, we know that `self.ptr` is non-null and valid.
109109
unsafe { bindings::signal_pending(self.ptr) != 0 }
110110
}
111+
112+
/// Wakes up the task.
113+
pub fn wake_up(&self) {
114+
// SAFETY: By the type invariant, we know that `self.ptr` is non-null and valid.
115+
// And `wake_up_process` is safe to be called for any valid task, even if the task is
116+
// running.
117+
unsafe {
118+
bindings::wake_up_process(self.ptr);
119+
}
120+
}
111121
}
112122

113123
impl PartialEq for Task {

0 commit comments

Comments
 (0)