changeset 138:4249a55f859a

Attempt to fix behavior on multi-CPU platforms
author Sebastien Decugis <sdecugis@nict.go.jp>
date Wed, 16 Dec 2009 17:09:32 +0900
parents 5510f73e1737
children 8b8d11fadc4e
files libfreeDiameter/fifo.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libfreeDiameter/fifo.c	Wed Dec 16 17:04:27 2009 +0900
+++ b/libfreeDiameter/fifo.c	Wed Dec 16 17:09:32 2009 +0900
@@ -159,8 +159,8 @@
 	q->eyec = 0xdead;
 	
 	while (q->thrs) {
+		CHECK_POSIX(  pthread_mutex_unlock( &q->mtx ));
 		CHECK_POSIX(  pthread_cond_signal(&q->cond)  );
-		CHECK_POSIX(  pthread_mutex_unlock( &q->mtx ));
 		sched_yield();
 		CHECK_POSIX(  pthread_mutex_lock( &q->mtx )  );
 		ASSERT( ++loops < 10 ); /* detect infinite loops */
@@ -207,8 +207,8 @@
 	/* Any waiting thread on the old queue returns an error */
 	old->eyec = 0xdead;
 	while (old->thrs) {
+		CHECK_POSIX(  pthread_mutex_unlock( &old->mtx ));
 		CHECK_POSIX(  pthread_cond_signal(&old->cond)  );
-		CHECK_POSIX(  pthread_mutex_unlock( &old->mtx ));
 		sched_yield();
 		CHECK_POSIX(  pthread_mutex_lock( &old->mtx )  );
 		ASSERT( ++loops < 10 ); /* detect infinite loops */
"Welcome to our mercurial repository"