file: 10-C-utils.t package: muf status: alpha
The pidToJob function accepts an integer pid
such as displayed by pj, and returns a corresponding
job. (Pids are assigned sequentially from the global
counter .muq$s.nextPid, which means it is
possible but normally unlikely for a two running jobs to
have the same pid. Pids are stored as job$s.name.)
It is currently implemented as:
: pidToJob { $ -> $ } -> pid
( Generate block of all non-killed )
( jobs owned by current user: )
me$s.psQueue jobQueueContents[
( Over all entries in block: )
|for j do{
j$s.name pid = if ]pop j return fi
}
]pop
[ "No job with pid %d." pid | ]print simpleError
;
See section pj rootPj.
file: 10-C-utils.t package: muf status: alpha
This convenience function calls pidToJob on
integer arguments while leaving other arguments
unchanged; It is useful in implementing functions
which indifferently accept either a job or a pid
as input.
It is currently implemented as:
: maybePidToJob { $ -> $ } -> pid
pid integer? if pid pidToJob -> pid fi
pid
;
Go to the first, previous, next, last section, table of contents.