Rename PENDING_REMOVAL to DISOWN_REQUESTED

A commend implied that PENDING_REMOVAL was broader than it was. In practice
only disown() sets this flag. Rename the flag for clarity.
This commit is contained in:
ridiculousfish 2019-04-28 22:33:29 -07:00
parent b5865d2cba
commit c05e72749a
3 changed files with 7 additions and 7 deletions

View file

@ -34,7 +34,7 @@ static int disown_job(const wchar_t *cmd, parser_t &parser, io_streams_t &stream
// We cannot directly remove the job from the jobs() list as `disown` might be called
// within the context of a subjob which will cause the parent job to crash in exec_job().
// Instead, we set a flag and the parser removes the job from the jobs list later.
j->set_flag(job_flag_t::PENDING_REMOVAL, true);
j->set_flag(job_flag_t::DISOWN_REQUESTED, true);
add_disowned_pgid(j->pgid);
return STATUS_CMD_OK;

View file

@ -537,7 +537,7 @@ static bool process_clean_after_marking(bool allow_interactive) {
// If the process has been previously flagged for removal, add it to the erase list without
// any further processing, but do not remove any jobs until their parent jobs have completed
// processing.
if (j->get_flag(job_flag_t::PENDING_REMOVAL) && j->job_chain_is_fully_constructed()) {
if (j->get_flag(job_flag_t::DISOWN_REQUESTED) && j->job_chain_is_fully_constructed()) {
erase_list.push_back(j);
}
// If all processes have completed, tell the user the job has completed and delete it from

View file

@ -255,10 +255,8 @@ enum class job_flag_t {
JOB_CONTROL,
/// Whether the job wants to own the terminal when in the foreground.
TERMINAL,
/// This job needs to be removed from the list of jobs for one reason or another (killed,
/// completed, disowned, etc). This flag is set rather than directly manipulating the jobs
/// list.
PENDING_REMOVAL,
/// This job is disowned, and should be removed from the active jobs list.
DISOWN_REQUESTED,
JOB_FLAG_COUNT
};
@ -399,7 +397,9 @@ class job_t {
/// The job is in a stopped state
bool is_stopped() const;
/// The job is OK to be externally visible, e.g. to the user via `jobs`
bool is_visible() const { return !is_completed() && is_constructed() && !get_flag(job_flag_t::PENDING_REMOVAL); };
bool is_visible() const {
return !is_completed() && is_constructed() && !get_flag(job_flag_t::DISOWN_REQUESTED);
};
/// \return the parent job, or nullptr.
const std::shared_ptr<job_t> get_parent() const { return parent_job; }