From fb0a0ef83b4df321c45288ba4804c8350d9d1654 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 29 Nov 2015 21:20:42 +0100 Subject: [PATCH] simplified abnormal process termination --- include/utils.h | 7 ------- lib/utils.c | 12 +++--------- src/server.c | 2 -- src/test.c | 2 -- 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/include/utils.h b/include/utils.h index 86730efa8..a35195066 100644 --- a/include/utils.h +++ b/include/utils.h @@ -66,13 +66,6 @@ struct settings; struct timespec; -/** The main thread id. - * This is used to notify the main thread about - * the program termination. - * See error() macros. - */ -extern pthread_t _mtid; - /** Normal random variate generator using the Box-Muller method * * @param m Mean diff --git a/lib/utils.c b/lib/utils.c index d0fe310b2..99a491ca9 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -92,17 +92,11 @@ double randf() return (double) random() / RAND_MAX; } -/** This global variable holds the main thread ID. - * Its used by die(). - */ -pthread_t _mtid; - void die() { - if (pthread_equal(_mtid, pthread_self())) - exit(EXIT_FAILURE); - else - pthread_kill(_mtid, SIGINT); + int zero = 0; + log_outdent(&zero); + abort(); } char * strcatf(char **dest, const char *fmt, ...) diff --git a/src/server.c b/src/server.c index 92eebdbbf..d7c5cda6a 100644 --- a/src/server.c +++ b/src/server.c @@ -120,8 +120,6 @@ static void usage(const char *name) int main(int argc, char *argv[]) { - _mtid = pthread_self(); - /* Check arguments */ #ifdef ENABLE_OPAL_ASYNC if (argc != 2 && argc != 4) diff --git a/src/test.c b/src/test.c index 11cc7dbe4..edab78f0a 100644 --- a/src/test.c +++ b/src/test.c @@ -62,8 +62,6 @@ int main(int argc, char *argv[]) { config_t config; - _mtid = pthread_self(); - if (argc < 4) { printf("Usage: %s CONFIG TEST NODE [ARGS]\n", argv[0]); printf(" CONFIG path to a configuration file\n");