mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
Convert job_list to a dequeue again
Now that we have cleaned up access to the job list and removed transparent invalidation of iterators, it is safe to convert it to a dequeue.
This commit is contained in:
parent
f8e0e0ef82
commit
6fab783647
3 changed files with 5 additions and 5 deletions
|
@ -580,7 +580,7 @@ void parser_t::job_promote(job_t *job) {
|
||||||
assert(loc != my_job_list.end());
|
assert(loc != my_job_list.end());
|
||||||
|
|
||||||
// Move the job to the beginning.
|
// Move the job to the beginning.
|
||||||
my_job_list.splice(my_job_list.begin(), my_job_list, loc);
|
std::rotate(my_job_list.begin(), loc, my_job_list.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
job_t *parser_t::job_get(job_id_t id) {
|
job_t *parser_t::job_get(job_id_t id) {
|
||||||
|
|
|
@ -475,7 +475,7 @@ static bool process_clean_after_marking(bool allow_interactive) {
|
||||||
|
|
||||||
bool erased = false;
|
bool erased = false;
|
||||||
const bool only_one_job = jobs().size() == 1;
|
const bool only_one_job = jobs().size() == 1;
|
||||||
for (auto itr = jobs().begin(); itr != jobs().end(); itr = (erased ? itr : (std::advance(itr, 1), itr)), erased = false) {
|
for (auto itr = jobs().begin(); itr != jobs().end(); itr = erased ? itr : itr + 1, erased = false) {
|
||||||
job_t *j = itr->get();
|
job_t *j = itr->get();
|
||||||
// If we are reaping only jobs who do not need status messages sent to the console, do not
|
// If we are reaping only jobs who do not need status messages sent to the console, do not
|
||||||
// consider reaping jobs that need status messages.
|
// consider reaping jobs that need status messages.
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <list>
|
#include <deque>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -451,8 +451,8 @@ extern bool is_login;
|
||||||
/// nesting level.
|
/// nesting level.
|
||||||
extern int is_event;
|
extern int is_event;
|
||||||
|
|
||||||
// List of jobs. We sometimes mutate this while iterating - hence it must be a list, not a vector
|
// List of jobs.
|
||||||
typedef std::list<shared_ptr<job_t>> job_list_t;
|
typedef std::deque<shared_ptr<job_t>> job_list_t;
|
||||||
|
|
||||||
bool job_list_is_empty(void);
|
bool job_list_is_empty(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue