pub struct JobTable { /* private fields */ }Expand description
The executor’s bg-job registry. Distinct from the C-port
JOBTAB (a Vec<Job> keyed by index that mirrors jobtab[]):
this table owns the std::process::Child handles needed for
try_wait / kill on the safe-Rust path.
Implementations§
Source§impl JobTable
impl JobTable
pub fn new() -> Self
Sourcepub fn peek_next_id(&self) -> usize
pub fn peek_next_id(&self) -> usize
Peek at the next id that would be assigned by add_job/add_pid.
Used by wait %N to distinguish a never-issued id (clear user
error) from a job that was issued and already reaped (silent
success in zshrs to keep the cmd & wait %1 idiom working
across the races introduced by the threaded job table).
Sourcepub fn add_job(
&mut self,
child: Child,
command: String,
state: JobState,
) -> usize
pub fn add_job( &mut self, child: Child, command: String, state: JobState, ) -> usize
Add a job with a Child process
Sourcepub fn add_pid_job(
&mut self,
pid: i32,
command: String,
state: JobState,
) -> usize
pub fn add_pid_job( &mut self, pid: i32, command: String, state: JobState, ) -> usize
Register a backgrounded job that was forked via raw libc::fork()
(no std::process::Child wrapper). The wait path then has to
waitpid(pid) instead of Child::wait(). Used by
BUILTIN_RUN_BG so wait (no args) can synchronize on it.
Sourcepub fn iter(&self) -> impl Iterator<Item = (usize, &JobInfo)>
pub fn iter(&self) -> impl Iterator<Item = (usize, &JobInfo)>
Iterate over jobs with their IDs (for compatibility)
Sourcepub fn reap_finished(&mut self) -> Vec<JobInfo>
pub fn reap_finished(&mut self) -> Vec<JobInfo>
Reap finished jobs (check for completed processes)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JobTable
impl RefUnwindSafe for JobTable
impl Send for JobTable
impl Sync for JobTable
impl Unpin for JobTable
impl UnsafeUnpin for JobTable
impl UnwindSafe for JobTable
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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