From 8c9c77880ec193e922c7133f5affe5663c0b7a6b Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 22 Jul 2009 19:04:58 +0000 Subject: [PATCH] Made the annotate_rwlock test compile on Darwin. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10531 --- drd/tests/annotate_rwlock.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drd/tests/annotate_rwlock.c b/drd/tests/annotate_rwlock.c index 1d4ee859af..952ed21e2e 100644 --- a/drd/tests/annotate_rwlock.c +++ b/drd/tests/annotate_rwlock.c @@ -13,6 +13,7 @@ #include #include #include +#include /* usleep() */ #include "../../config.h" #include "../../drd/drd.h" @@ -59,7 +60,12 @@ static void rwlock_rdlock(rwlock_t* p) ; if (p->writer_count == 0) break; +#ifdef __APPLE__ + /* Darwin doesn't have an implementation of pthread_yield(). */ + usleep(100 * 1000); +#else pthread_yield(); +#endif __sync_fetch_and_sub(&p->locked, 1); } p->reader_count++; @@ -78,7 +84,12 @@ static void rwlock_wrlock(rwlock_t* p) ; if (p->reader_count == 0) break; +#ifdef __APPLE__ + /* Darwin doesn't have an implementation of pthread_yield(). */ + usleep(100 * 1000); +#else pthread_yield(); +#endif __sync_fetch_and_sub(&p->locked, 1); } p->writer_count++; -- 2.47.3