mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 16:19:13 +08:00
Use sigint_checker_t in debug_thread_error
This commit is contained in:
parent
ea3ad0c099
commit
5a4df9dd3a
|
@ -55,6 +55,7 @@
|
||||||
#include "future_feature_flags.h"
|
#include "future_feature_flags.h"
|
||||||
#include "global_safety.h"
|
#include "global_safety.h"
|
||||||
#include "proc.h"
|
#include "proc.h"
|
||||||
|
#include "signal.h"
|
||||||
#include "wildcard.h"
|
#include "wildcard.h"
|
||||||
#include "wutil.h" // IWYU pragma: keep
|
#include "wutil.h" // IWYU pragma: keep
|
||||||
|
|
||||||
|
@ -2271,9 +2272,8 @@ extern "C" {
|
||||||
[[gnu::noinline]] void debug_thread_error(void) {
|
[[gnu::noinline]] void debug_thread_error(void) {
|
||||||
// Wait for a SIGINT. We can't use sigsuspend() because the signal may be delivered on another
|
// Wait for a SIGINT. We can't use sigsuspend() because the signal may be delivered on another
|
||||||
// thread.
|
// thread.
|
||||||
auto &tm = topic_monitor_t::principal();
|
sigint_checker_t sigint;
|
||||||
auto gens = tm.current_generations();
|
sigint.wait();
|
||||||
tm.check(&gens, {topic_t::sighupint}, true /* wait */);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -431,3 +431,10 @@ bool sigint_checker_t::check() {
|
||||||
this->gen_ = gen;
|
this->gen_ = gen;
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sigint_checker_t::wait() {
|
||||||
|
auto &tm = topic_monitor_t::principal();
|
||||||
|
generation_list_t gens{};
|
||||||
|
gens[topic_t::sighupint] = this->gen_;
|
||||||
|
tm.check(&gens, {topic_t::sighupint}, true /* wait */);
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,9 @@ class sigint_checker_t {
|
||||||
/// Check if a sigint has been delivered since the last call to check(), or since the detector
|
/// Check if a sigint has been delivered since the last call to check(), or since the detector
|
||||||
/// was created.
|
/// was created.
|
||||||
bool check();
|
bool check();
|
||||||
|
|
||||||
|
/// Wait until a sigint is delivered.
|
||||||
|
void wait();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user