pub struct ProcessGroup {
pub session: Arc<Session>,
pub leader: pid_t,
/* private fields */
}Fields§
§session: Arc<Session>The session of the process group.
leader: pid_tThe leader of the process group.
Implementations§
Source§impl ProcessGroup
A process group is a set of processes that are considered to be a unit for the purposes of job
control and signal delivery. Each process in a process group has the same process group
ID (PGID). The process with the same PID as the PGID is called the process group leader.
impl ProcessGroup
A process group is a set of processes that are considered to be a unit for the purposes of job control and signal delivery. Each process in a process group has the same process group ID (PGID). The process with the same PID as the PGID is called the process group leader.
When a signal is sent to a process group, it is delivered to all processes in the group, including the process group leader. This allows a single signal to be used to control all processes in a group, such as stopping or resuming them all.
Process groups are also used for job control. The foreground and background process groups of a terminal are used to determine which processes can read from and write to the terminal. The foreground process group is the only process group that can read from and write to the terminal at any given time.
When a process forks from its parent, the child process inherits the parent’s PGID. A process can also explicitly change its own PGID using the setpgid() system call.
Process groups are destroyed when the last process in the group exits.
pub fn new(leader: pid_t, session: Option<Arc<Session>>) -> Arc<ProcessGroup>
pub fn read<'a, L>(
self: &'a ProcessGroup,
locked: &'a mut Locked<L>,
) -> ProcessGroupReadGuard<'a>where
L: LockBefore<ProcessGroupState>,
pub fn write<'a, L>(
self: &'a ProcessGroup,
locked: &'a mut Locked<L>,
) -> ProcessGroupWriteGuard<'a>where
L: LockBefore<ProcessGroupState>,
pub fn insert<L>(&self, locked: &mut Locked<L>, thread_group: &ThreadGroup)where
L: LockBefore<ProcessGroupState>,
Sourcepub fn remove<L>(
&self,
locked: &mut Locked<L>,
thread_group: &ThreadGroup,
) -> boolwhere
L: LockBefore<ProcessGroupState>,
pub fn remove<L>(
&self,
locked: &mut Locked<L>,
thread_group: &ThreadGroup,
) -> boolwhere
L: LockBefore<ProcessGroupState>,
Removes the thread group from the process group. Returns whether the process group is empty.
pub fn send_signals<L>(&self, locked: &mut Locked<L>, signals: &[Signal])where
L: LockBefore<ProcessGroupState>,
Sourcepub fn check_orphaned<L>(&self, locked: &mut Locked<L>, _pids: &PidTable)where
L: LockBefore<ProcessGroupState>,
pub fn check_orphaned<L>(&self, locked: &mut Locked<L>, _pids: &PidTable)where
L: LockBefore<ProcessGroupState>,
Check whether the process group became orphaned. If this is the case, send signals to its members if at least one is stopped.
Takes a read lock on the PidTable to ensure the object cannot be removed while this method is running.
Trait Implementations§
Source§impl Debug for ProcessGroup
impl Debug for ProcessGroup
Source§impl Hash for ProcessGroup
impl Hash for ProcessGroup
Source§impl PartialEq for ProcessGroup
impl PartialEq for ProcessGroup
impl Eq for ProcessGroup
Auto Trait Implementations§
impl !Freeze for ProcessGroup
impl !RefUnwindSafe for ProcessGroup
impl Send for ProcessGroup
impl Sync for ProcessGroup
impl Unpin for ProcessGroup
impl !UnwindSafe for ProcessGroup
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more