changeset 137:5510f73e1737

Replace non-posix pthread_yield with posix sched_yield
author Sebastien Decugis <sdecugis@nict.go.jp>
date Wed, 16 Dec 2009 17:04:27 +0900
parents abd3c441780b
children 4249a55f859a
files freeDiameter/peers.c include/freeDiameter/libfreeDiameter.h libfreeDiameter/fifo.c
diffstat 3 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/freeDiameter/peers.c	Wed Dec 16 16:51:42 2009 +0900
+++ b/freeDiameter/peers.c	Wed Dec 16 17:04:27 2009 +0900
@@ -300,7 +300,7 @@
 	while ((!list_empty) && (TS_IS_INFERIOR(&now, &wait_until))) {
 		
 		/* Allow the PSM(s) to execute */
-		pthread_yield();
+		sched_yield();
 		
 		/* Remove zombie peers */
 		CHECK_FCT_DO( pthread_rwlock_wrlock(&fd_g_peers_rw), /* continue */ );
--- a/include/freeDiameter/libfreeDiameter.h	Wed Dec 16 16:51:42 2009 +0900
+++ b/include/freeDiameter/libfreeDiameter.h	Wed Dec 16 17:04:27 2009 +0900
@@ -59,6 +59,7 @@
 #endif /* FD_IS_CONFIG */
 
 #include <pthread.h>
+#include <sched.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
--- a/libfreeDiameter/fifo.c	Wed Dec 16 16:51:42 2009 +0900
+++ b/libfreeDiameter/fifo.c	Wed Dec 16 17:04:27 2009 +0900
@@ -161,7 +161,7 @@
 	while (q->thrs) {
 		CHECK_POSIX(  pthread_cond_signal(&q->cond)  );
 		CHECK_POSIX(  pthread_mutex_unlock( &q->mtx ));
-		pthread_yield();
+		sched_yield();
 		CHECK_POSIX(  pthread_mutex_lock( &q->mtx )  );
 		ASSERT( ++loops < 10 ); /* detect infinite loops */
 	}
@@ -209,7 +209,7 @@
 	while (old->thrs) {
 		CHECK_POSIX(  pthread_cond_signal(&old->cond)  );
 		CHECK_POSIX(  pthread_mutex_unlock( &old->mtx ));
-		pthread_yield();
+		sched_yield();
 		CHECK_POSIX(  pthread_mutex_lock( &old->mtx )  );
 		ASSERT( ++loops < 10 ); /* detect infinite loops */
 	}
"Welcome to our mercurial repository"