diff options
author | Andrey Nazarov <skuller@skuller.net> | 2012-08-12 19:41:09 +0400 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2012-08-12 19:41:09 +0400 |
commit | 3b2b27faa5d37dd180636bd93f1fd2abf71fd1c1 (patch) | |
tree | ed7e78a868bccba7dcff0085090058ec540ddde2 | |
parent | ae904634871dab4127472ab07a0b06108d71f327 (diff) |
Minimize work done in signal handlers.
In particular, don't make any X11 calls to avoid deadlock if interrupted
within libX11.
-rw-r--r-- | src/unix/system.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/unix/system.c b/src/unix/system.c index 0911627..574ac0f 100644 --- a/src/unix/system.c +++ b/src/unix/system.c @@ -45,6 +45,8 @@ cvar_t *sys_forcegamelib; cvar_t *sys_parachute; +static qboolean terminate; + /* =============================================================================== @@ -143,14 +145,15 @@ static void term_handler(int signum) #else Com_Printf("Received signal %d, exiting\n", signum); #endif - Com_Quit(NULL, ERR_DISCONNECT); + + terminate = qtrue; } static void kill_handler(int signum) { tty_shutdown_input(); -#if USE_CLIENT && USE_REF +#if USE_CLIENT && USE_REF && !USE_X11 VID_FatalShutdown(); #endif @@ -461,10 +464,11 @@ int main(int argc, char **argv) } Qcommon_Init(argc, argv); - while (1) { + while (!terminate) { Qcommon_Frame(); } + Com_Quit(NULL, ERR_DISCONNECT); return EXIT_FAILURE; // never gets here } |