mirror of
https://github.com/aristocratos/btop.git
synced 2024-05-20 20:32:50 +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;
|
||||
}
|
||||
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
|
||||
#ifndef __APPLE__
|
||||
if (Tools::active_locks > 0) {
|
||||
quick_exit((sig != -1 ? sig : 0));
|
||||
}
|
||||
quick_exit(excode);
|
||||
#endif
|
||||
|
||||
if (sig != -1) exit(sig);
|
||||
exit(excode);
|
||||
}
|
||||
|
||||
//* Handler for SIGTSTP; stops threads, restores terminal and sends SIGSTOP
|
||||
|
|
|
@ -82,14 +82,10 @@ namespace Input {
|
|||
|
||||
struct InputThr {
|
||||
InputThr() : thr(run, this) {
|
||||
thr.detach();
|
||||
}
|
||||
|
||||
static void run(InputThr* that) {
|
||||
try {
|
||||
that->runImpl();
|
||||
} catch (...) {}
|
||||
delete that;
|
||||
that->runImpl();
|
||||
}
|
||||
|
||||
void runImpl() {
|
||||
|
@ -124,6 +120,7 @@ namespace Input {
|
|||
}
|
||||
|
||||
static InputThr& instance() {
|
||||
// intentional memory leak, to simplify shutdown process
|
||||
static InputThr* input = new InputThr();
|
||||
|
||||
return *input;
|
||||
|
|
Loading…
Reference in a new issue