From: Bart Van Assche Date: Wed, 22 Jul 2009 19:04:58 +0000 (+0000) Subject: Made the annotate_rwlock test compile on Darwin. X-Git-Tag: svn/VALGRIND_3_5_0~317 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8c9c77880ec193e922c7133f5affe5663c0b7a6b;p=thirdparty%2Fvalgrind.git Made the annotate_rwlock test compile on Darwin. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10531 --- 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++;