mirror of
https://github.com/aristocratos/btop.git
synced 2024-06-03 11:04:39 +12:00
parent
fe66d52a38
commit
c1f540e61e
10
src/btop.cpp
10
src/btop.cpp
|
@ -237,15 +237,15 @@ void clean_quit(int sig) {
|
||||||
std::cerr << Global::fg_red << "ERROR: " << Global::fg_white << Global::exit_error_msg << Fx::reset << endl;
|
std::cerr << Global::fg_red << "ERROR: " << Global::fg_white << Global::exit_error_msg << Fx::reset << endl;
|
||||||
}
|
}
|
||||||
Logger::info("Quitting! Runtime: " + sec_to_dhms(time_s() - Global::start_time));
|
Logger::info("Quitting! Runtime: " + sec_to_dhms(time_s() - Global::start_time));
|
||||||
close(0);
|
|
||||||
|
const auto excode = (sig != -1 ? sig : 0);
|
||||||
|
|
||||||
//? Assume error if still not cleaned up and call quick_exit to avoid a segfault from Tools::atomic_lock destructor
|
//? Assume error if still not cleaned up and call quick_exit to avoid a segfault from Tools::atomic_lock destructor
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
if (Tools::active_locks > 0) {
|
quick_exit(excode);
|
||||||
quick_exit((sig != -1 ? sig : 0));
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sig != -1) exit(sig);
|
exit(excode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//* Handler for SIGTSTP; stops threads, restores terminal and sends SIGSTOP
|
//* Handler for SIGTSTP; stops threads, restores terminal and sends SIGSTOP
|
||||||
|
|
|
@ -82,14 +82,10 @@ namespace Input {
|
||||||
|
|
||||||
struct InputThr {
|
struct InputThr {
|
||||||
InputThr() : thr(run, this) {
|
InputThr() : thr(run, this) {
|
||||||
thr.detach();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void run(InputThr* that) {
|
static void run(InputThr* that) {
|
||||||
try {
|
that->runImpl();
|
||||||
that->runImpl();
|
|
||||||
} catch (...) {}
|
|
||||||
delete that;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void runImpl() {
|
void runImpl() {
|
||||||
|
@ -124,6 +120,7 @@ namespace Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
static InputThr& instance() {
|
static InputThr& instance() {
|
||||||
|
// intentional memory leak, to simplify shutdown process
|
||||||
static InputThr* input = new InputThr();
|
static InputThr* input = new InputThr();
|
||||||
|
|
||||||
return *input;
|
return *input;
|
||||||
|
|
Loading…
Reference in a new issue