mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 14:01:20 -03:00
Refactor wait handles
In preparation for using wait handles in --on-process-exit events, factor wait handles into their own wait handle store. Also switch them to per-process instead of per-job, which is a simplification.
This commit is contained in:
19
src/parser.h
19
src/parser.h
@@ -20,6 +20,7 @@
|
||||
#include "parse_tree.h"
|
||||
#include "proc.h"
|
||||
#include "util.h"
|
||||
#include "wait_handle.h"
|
||||
|
||||
class io_chain_t;
|
||||
|
||||
@@ -252,9 +253,9 @@ class parser_t : public std::enable_shared_from_this<parser_t> {
|
||||
/// The jobs associated with this parser.
|
||||
job_list_t job_list;
|
||||
|
||||
/// The list of recorded wait-handles. These are jobs that finished in the background, and have
|
||||
/// Our store of recorded wait-handles. These are jobs that finished in the background, and have
|
||||
/// been reaped, but may still be wait'ed on.
|
||||
std::deque<wait_handle_ref_t> rec_wait_handles;
|
||||
wait_handle_store_t wait_handles;
|
||||
|
||||
/// The list of blocks. This is a deque because we give out raw pointers to callers, who hold
|
||||
/// them across manipulating this stack.
|
||||
@@ -367,10 +368,9 @@ class parser_t : public std::enable_shared_from_this<parser_t> {
|
||||
library_data_t &libdata() { return library_data; }
|
||||
const library_data_t &libdata() const { return library_data; }
|
||||
|
||||
/// Access the list of wait handles for jobs that have finished in the background.
|
||||
const std::deque<wait_handle_ref_t> &get_recorded_wait_handles() const {
|
||||
return rec_wait_handles;
|
||||
}
|
||||
/// Get our wait handle store.
|
||||
wait_handle_store_t &get_wait_handles() { return wait_handles; }
|
||||
const wait_handle_store_t &get_wait_handles() const { return wait_handles; }
|
||||
|
||||
/// Get and set the last proc statuses.
|
||||
int get_last_status() const { return vars().get_last_status(); }
|
||||
@@ -408,13 +408,6 @@ class parser_t : public std::enable_shared_from_this<parser_t> {
|
||||
/// Returns the job with the given pid.
|
||||
job_t *job_get_from_pid(pid_t pid) const;
|
||||
|
||||
/// Given that a job has completed, check if it may be wait'ed on; if so add it to our list of
|
||||
/// wait handles.
|
||||
void save_wait_handle_for_completed_job(job_t *job);
|
||||
|
||||
/// Remove a wait handle, if present in the list.
|
||||
void wait_handle_remove(const wait_handle_ref_t &handle);
|
||||
|
||||
/// Returns a new profile item if profiling is active. The caller should fill it in.
|
||||
/// The parser_t will deallocate it.
|
||||
/// If profiling is not active, this returns nullptr.
|
||||
|
||||
Reference in New Issue
Block a user