#include <stdlib.h> /* atoi() */
#include <string.h> /* memset() */
#include "../../drd/drd.h"
+#include "../../config.h"
#define BARRIER_SERIAL_THREAD -1
{
while (b->barrier_count == barrier_count)
{
-#ifdef __APPLE__
+#ifndef HAVE_PTHREAD_YIELD
/* Darwin doesn't have an implementation of pthread_yield(). */
usleep(100 * 1000);
#else
;
if (p->writer_count == 0)
break;
-#ifdef __APPLE__
+#ifndef HAVE_PTHREAD_YIELD
/* Darwin doesn't have an implementation of pthread_yield(). */
usleep(100 * 1000);
#else
;
if (p->reader_count == 0)
break;
-#ifdef __APPLE__
+#ifndef HAVE_PTHREAD_YIELD
/* Darwin doesn't have an implementation of pthread_yield(). */
usleep(100 * 1000);
#else
static sem_t* create_semaphore(const char* const name, const int value)
{
-#ifdef __APPLE__
+#ifndef HAVE_SEM_INIT
sem_t* p = sem_open(name, O_CREAT, 0600, value);
return p;
#else
static void destroy_semaphore(const char* const name, sem_t* p)
{
-#ifdef __APPLE__
+#ifndef HAVE_SEM_INIT
sem_close(p);
sem_unlink(name);
#else
#include <sys/time.h> // gettimeofday()
#include <time.h> // struct timespec
#include <unistd.h>
+#include "../../config.h"
#define PTH_CALL(expr) \
static sem_t* create_semaphore(const char* const name)
{
-#ifdef __APPLE__
+#ifndef HAVE_SEM_INIT
sem_t* p = sem_open(name, O_CREAT, 0600, 0);
return p;
#else
static void destroy_semaphore(const char* const name, sem_t* p)
{
-#ifdef __APPLE__
+#ifndef HAVE_SEM_INIT
sem_close(p);
sem_unlink(name);
#else