Lines Matching full:task

10 /// Returns the currently running task.
16 unsafe { &*$crate::task::Task::current() }
44 /// Getting the current task and storing it in some struct. The reference count is automatically
48 /// use kernel::{task::Task, types::ARef};
51 /// creator: ARef<Task>,
65 pub struct Task(pub(crate) Opaque<bindings::task_struct>); struct
67 // SAFETY: By design, the only way to access a `Task` is via the `current` function or via an
68 // `ARef<Task>` obtained through the `AlwaysRefCounted` impl. This means that the only situation in
69 // which a `Task` can be accessed mutably is when the refcount drops to zero and the destructor
71 unsafe impl Send for Task {} implementation
73 // SAFETY: It's OK to access `Task` through shared references from other threads because we're
76 unsafe impl Sync for Task {} implementation
81 impl Task { impl
82 /// Returns a task reference for the currently executing task/thread.
84 /// The recommended way to get the current task/thread is to use the
89 /// Callers must ensure that the returned object doesn't outlive the current task/thread.
90 pub unsafe fn current() -> impl Deref<Target = Task> { in current()
92 task: &'a Task, in current() field
97 type Target = Task; in current()
100 self.task in current()
108 // SAFETY: If the current thread is still running, the current task is valid. Given in current()
111 task: unsafe { &*ptr.cast() }, in current()
116 /// Returns the group leader of the given task.
117 pub fn group_leader(&self) -> &Task { in group_leader() argument
118 // SAFETY: By the type invariant, we know that `self.0` is a valid task. Valid tasks always in group_leader()
122 // SAFETY: The lifetime of the returned task reference is tied to the lifetime of `self`, in group_leader()
123 // and given that a task has a reference to its group leader, we know it must be valid for in group_leader()
124 // the lifetime of the returned task reference. in group_leader()
128 /// Returns the PID of the given task.
130 // SAFETY: By the type invariant, we know that `self.0` is a valid task. Valid tasks always in pid()
135 /// Determines whether the given task has pending signals.
141 /// Wakes up the task.
144 // And `wake_up_process` is safe to be called for any valid task, even if the task is in wake_up()
150 // SAFETY: The type invariants guarantee that `Task` is always ref-counted.
151 unsafe impl crate::types::AlwaysRefCounted for Task { implementation