using quick exit

This commit is contained in:
Dun Liang 2021-02-16 17:55:02 +08:00
parent 7d6cb61419
commit fbc038cd66
2 changed files with 6 additions and 3 deletions

View File

@ -8,7 +8,7 @@
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# ***************************************************************
__version__ = '1.2.2.30'
__version__ = '1.2.2.31'
from . import lock
with lock.lock_scope():
ori_int = int

View File

@ -10,6 +10,7 @@
#include <iomanip>
#include <thread>
#include <unordered_map>
#include <unistd.h>
#include "utils/log.h"
#include "utils/mwsr_list.h"
@ -184,12 +185,14 @@ bool exited = false;
size_t thread_local protected_page = 0;
int segfault_happen = 0;
string thread_local thread_name;
static int _pid = getpid();
void segfault_sigaction(int signal, siginfo_t *si, void *arg) {
if (signal == SIGINT) {
LOGe << "Caught SIGINT, exit";
if (_pid == getpid())
LOGe << "Caught SIGINT, quick exit";
exited = true;
exit(1);
std::quick_exit(1);
}
std::cerr << "Caught segfault at address " << si->si_addr << ", "
<< "thread_name: '" << thread_name << "', flush log..." << std::endl;