From 1bb58646de07501c96c53a963820ef70f73d50c5 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Wed, 13 Aug 2003 15:25:16 +0000 Subject: Totally revamp thread debugging to support locating and removing deadlocks git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1310 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- asterisk.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'asterisk.c') diff --git a/asterisk.c b/asterisk.c index ccc384574..8813c0722 100755 --- a/asterisk.c +++ b/asterisk.c @@ -75,7 +75,7 @@ static struct ast_atexit { void (*func)(void); struct ast_atexit *next; } *atexits = NULL; -static pthread_mutex_t atexitslock = AST_MUTEX_INITIALIZER; +static ast_mutex_t atexitslock = AST_MUTEX_INITIALIZER; time_t ast_startuptime; time_t ast_lastreloadtime; @@ -111,7 +111,7 @@ int ast_register_atexit(void (*func)(void)) struct ast_atexit *ae; ast_unregister_atexit(func); ae = malloc(sizeof(struct ast_atexit)); - ast_pthread_mutex_lock(&atexitslock); + ast_mutex_lock(&atexitslock); if (ae) { memset(ae, 0, sizeof(struct ast_atexit)); ae->next = atexits; @@ -119,14 +119,14 @@ int ast_register_atexit(void (*func)(void)) atexits = ae; res = 0; } - ast_pthread_mutex_unlock(&atexitslock); + ast_mutex_unlock(&atexitslock); return res; } void ast_unregister_atexit(void (*func)(void)) { struct ast_atexit *ae, *prev = NULL; - ast_pthread_mutex_lock(&atexitslock); + ast_mutex_lock(&atexitslock); ae = atexits; while(ae) { if (ae->func == func) { @@ -139,7 +139,7 @@ void ast_unregister_atexit(void (*func)(void)) prev = ae; ae = ae->next; } - ast_pthread_mutex_unlock(&atexitslock); + ast_mutex_unlock(&atexitslock); } static int fdprint(int fd, const char *s) @@ -402,14 +402,14 @@ static int shuttingdown = 0; static void ast_run_atexits(void) { struct ast_atexit *ae; - ast_pthread_mutex_lock(&atexitslock); + ast_mutex_lock(&atexitslock); ae = atexits; while(ae) { if (ae->func) ae->func(); ae = ae->next; } - ast_pthread_mutex_unlock(&atexitslock); + ast_mutex_unlock(&atexitslock); } static void quit_handler(int num, int nice, int safeshutdown, int restart) -- cgit v1.2.3