mirror of https://github.com/Jittor/Jittor
using quick exit
This commit is contained in:
parent
7d6cb61419
commit
fbc038cd66
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue