File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -180,13 +180,22 @@ impl Task {
180
180
181
181
// SAFETY: Since the kthread creation succeeded and we haven't run it yet, we know the task
182
182
// is valid.
183
- let task = unsafe { & * ( ktask as * const Task ) } . into ( ) ;
183
+ let task: ARef < _ > = unsafe { & * ( ktask as * const Task ) } . into ( ) ;
184
+
185
+ // Wakes up the thread, otherwise it won't run.
186
+ task. wake_up ( ) ;
184
187
185
- // SAFETY: Since the kthread creation succeeded, we know `ktask` is valid.
186
- unsafe { bindings:: wake_up_process ( ktask) } ;
187
188
guard. dismiss ( ) ;
188
189
Ok ( task)
189
190
}
191
+
192
+ /// Wakes up the task.
193
+ pub fn wake_up ( & self ) {
194
+ // SAFETY: By the type invariant, we know that `self.0.get()` is non-null and valid.
195
+ // And `wake_up_process` is safe to be called for any valid task, even if the task is
196
+ // running.
197
+ unsafe { bindings:: wake_up_process ( self . 0 . get ( ) ) } ;
198
+ }
190
199
}
191
200
192
201
// SAFETY: The type invariants guarantee that `Task` is always ref-counted.
You can’t perform that action at this time.
0 commit comments