|
From: <sv...@va...> - 2009-07-22 19:12:16
|
Author: bart
Date: 2009-07-22 20:04:58 +0100 (Wed, 22 Jul 2009)
New Revision: 10531
Log:
Made the annotate_rwlock test compile on Darwin.
Modified:
trunk/drd/tests/annotate_rwlock.c
Modified: trunk/drd/tests/annotate_rwlock.c
===================================================================
--- trunk/drd/tests/annotate_rwlock.c 2009-07-22 19:04:23 UTC (rev 10530)
+++ trunk/drd/tests/annotate_rwlock.c 2009-07-22 19:04:58 UTC (rev 10531)
@@ -13,6 +13,7 @@
#include <assert.h>
#include <pthread.h>
#include <stdio.h>
+#include <unistd.h> /* usleep() */
#include "../../config.h"
#include "../../drd/drd.h"
@@ -59,7 +60,12 @@
;
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 @@
;
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++;
|