Skip to content

Commit

Permalink
core, feat: exit application directly while v8 is not alive.
Browse files Browse the repository at this point in the history
  • Loading branch information
xicilion committed Oct 17, 2017
1 parent 4ec77e3 commit 5b2c83f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fibjs/src/process/process_signal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
namespace fibjs {

extern exlib::LockedList<Isolate> s_isolates;
exlib::atomic s_check_callback;

static void _InterruptCallback(v8::Isolate* v8_isolate, void* data)
{
s_check_callback = 0;
Isolate* isolate = Isolate::current();
JSTrigger t(isolate->m_isolate, process_base::class_info().getModule(isolate));
bool r = false;
Expand All @@ -35,6 +37,9 @@ static void _InterruptCallback(v8::Isolate* v8_isolate, void* data)

void on_signal(int32_t s)
{
if (s_check_callback.CompareAndSwap(0, 1) != 0)
_exit(1);

const char* name = NULL;

switch (s) {
Expand All @@ -46,8 +51,8 @@ void on_signal(int32_t s)
break;
#ifdef SIGBREAK
case SIGBREAK:
name = "SIGINT";
break;
name = "SIGINT";
break;
#endif
default:
_exit(1);
Expand Down

0 comments on commit 5b2c83f

Please sign in to comment.