From: Jérémie Astor Date: Mon, 9 Aug 2021 11:12:56 +0000 (+0200) Subject: :art: Improve signals X-Git-Tag: nightly~475 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=ec97fc92821f52d03a75c55ec39f7ea77347b1d6;p=gwion.git :art: Improve signals --- diff --git a/src/main.c b/src/main.c index 024a69ba..d3a59b0f 100644 --- a/src/main.c +++ b/src/main.c @@ -6,13 +6,13 @@ #include "gwion.h" #include "arg.h" +static struct Gwion_ gwion = {}; + static void sig(int unused NUSED) { -//#ifdef BUILD_ON_WINDOWS - exit(EXIT_FAILURE); -//#else -// pthread_kill(pthread_self(), SIGKILL); -// pthread_exit(NULL); -//#endif + if(gwion.vm) + gwion.vm->bbq->is_running = false; + else + exit(EXIT_FAILURE); } #ifdef __AFL_HAVE_MANUAL_CONTROL @@ -31,7 +31,6 @@ static void afl_run(const Gwion gwion) { int main(int argc, char **argv) { Arg arg = {}; - struct Gwion_ gwion = {}; gwion_ini(&gwion, &arg); arg_release(&arg); afl_run(&gwion);