From c05e72749a7669bb187faf89b102d379b336e8c3 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 28 Apr 2019 22:33:29 -0700 Subject: [PATCH] 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. --- src/builtin_disown.cpp | 2 +- src/proc.cpp | 2 +- src/proc.h | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/builtin_disown.cpp b/src/builtin_disown.cpp index 25654d138..09906a94c 100644 --- a/src/builtin_disown.cpp +++ b/src/builtin_disown.cpp @@ -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; diff --git a/src/proc.cpp b/src/proc.cpp index 2d71faf7b..4a01974de 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -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 diff --git a/src/proc.h b/src/proc.h index 340a39ddb..a03dd8cff 100644 --- a/src/proc.h +++ b/src/proc.h @@ -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 get_parent() const { return parent_job; }