pub struct Process { /* private fields */ }Expand description
A process.
Implementations§
Source§impl Process
impl Process
Sourcepub fn is_init(self: &Arc<Self>) -> bool
pub fn is_init(self: &Arc<Self>) -> bool
Returns true if the Process is the init process.
This is a convenience method for checking if the Process
Arc::ptr_eqs with the init process, which is cheaper than
calling init_proc or testing if Process::parent is None.
Source§impl Process
impl Process
Sourcepub fn group(&self) -> Arc<ProcessGroup>
pub fn group(&self) -> Arc<ProcessGroup>
The ProcessGroup that the Process belongs to.
Sourcepub fn create_session(
self: &Arc<Self>,
) -> Option<(Arc<Session>, Arc<ProcessGroup>)>
pub fn create_session( self: &Arc<Self>, ) -> Option<(Arc<Session>, Arc<ProcessGroup>)>
Creates a new Session and new ProcessGroup and moves the
Process to it.
If the Process is already a session leader, this method does
nothing and returns None.
Otherwise, it returns the new Session and ProcessGroup.
The caller has to ensure that the new ProcessGroup does not conflict
with any existing ProcessGroup. Thus, the Process must not
be a ProcessGroup leader.
Checking Session conflicts is unnecessary.
Sourcepub fn create_group(self: &Arc<Self>) -> Option<Arc<ProcessGroup>>
pub fn create_group(self: &Arc<Self>) -> Option<Arc<ProcessGroup>>
Creates a new ProcessGroup and moves the Process to it.
If the Process is already a group leader, this method does nothing
and returns None.
Otherwise, it returns the new ProcessGroup.
The caller has to ensure that the new ProcessGroup does not conflict
with any existing ProcessGroup.
Sourcepub fn move_to_group(self: &Arc<Self>, group: &Arc<ProcessGroup>) -> bool
pub fn move_to_group(self: &Arc<Self>, group: &Arc<ProcessGroup>) -> bool
Moves the Process to a specified ProcessGroup.
Returns true if the move succeeded. The move failed if the
ProcessGroup is not in the same Session as the Process.
If the Process is already in the specified ProcessGroup, this
method does nothing and returns true.
Source§impl Process
Threads
impl Process
Threads
Sourcepub fn add_thread(self: &Arc<Self>, tid: Pid)
pub fn add_thread(self: &Arc<Self>, tid: Pid)
Adds a thread to this Process with the given thread ID.
Sourcepub fn exit_thread(self: &Arc<Self>, tid: Pid, exit_code: i32) -> bool
pub fn exit_thread(self: &Arc<Self>, tid: Pid, exit_code: i32) -> bool
Removes a thread from this Process and sets the exit code if the
group has not exited.
Returns true if this was the last thread in the process.
Sourcepub fn is_group_exited(&self) -> bool
pub fn is_group_exited(&self) -> bool
Returns true if the Process is group exited.
Sourcepub fn group_exit(&self)
pub fn group_exit(&self)
Marks the Process as group exited.