changeset 200:ff557d8b48d7

Fix deadlock in some circumstances
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 09 Feb 2010 18:30:53 +0900
parents 3e79fef1031d
children 1b47afa59358
files libfreeDiameter/log.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libfreeDiameter/log.c	Tue Feb 09 18:23:07 2010 +0900
+++ b/libfreeDiameter/log.c	Tue Feb 09 18:30:53 2010 +0900
@@ -49,6 +49,12 @@
 int fd_breaks = 0;
 int fd_breakhere(void) { return ++fd_breaks; }
 
+static void fd_cleanup_mutex_silent( void * mutex )
+{
+	(void)pthread_mutex_unlock((pthread_mutex_t *)mutex);
+}
+
+
 /* Log a debug message */
 void fd_log_debug ( char * format, ... )
 {
@@ -56,7 +62,7 @@
 	
 	(void)pthread_mutex_lock(&fd_log_lock);
 	
-	pthread_cleanup_push(fd_cleanup_mutex, &fd_log_lock);
+	pthread_cleanup_push(fd_cleanup_mutex_silent, &fd_log_lock);
 	
 	va_start(ap, format);
 	vfprintf( stdout, format, ap);
"Welcome to our mercurial repository"