static sem_t* create_semaphore(const char* const name, const int value)
{
-#ifdef __APPLE__
+#ifdef VGO_darwin
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__
+#ifdef VGO_darwin
sem_close(p);
sem_unlink(name);
#else
* is zero, while Darwin's C library returns a non-NULL pointer. Both are
* allowed by POSIX.
*/
-#if defined(__APPLE__)
+#if defined(VGO_darwin)
if (p)
free(p);
#else
static sem_t* create_semaphore(const char* const name)
{
-#ifdef __APPLE__
+#ifdef VGO_darwin
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__
+#ifdef VGO_darwin
sem_close(p);
sem_unlink(name);
#else
#include <stdio.h>
#include <limits.h> // INT_MAX
-#ifdef __APPLE__
+#ifdef VGO_darwin
#include <libkern/OSAtomic.h>
#define NO_BARRIER
#define NO_TLS
#ifndef NO_SPINLOCK
/// helgrind does not (yet) support spin locks, so we annotate them.
-#ifndef __APPLE__
+#ifndef VGO_darwin
class SpinLock {
public:
SpinLock() {
private:
OSSpinLock mu_;
};
-#endif // __APPLE__
+#endif // VGO_darwin
#endif // NO_SPINLOCK
int AtomicIncrement(volatile int *value, int increment);
-#ifndef __APPLE__
+#ifndef VGO_darwin
inline int AtomicIncrement(volatile int *value, int increment) {
return __sync_add_and_fetch(value, increment);
}
*out = memalign(al, size);
return (*out == 0);
}
-#endif // __APPLE__
+#endif // VGO_darwin
#endif // THREAD_WRAPPERS_PTHREAD_H
// vim:shiftwidth=2:softtabstop=2:expandtab:foldmethod=marker
#include <stdlib.h>
#include <dirent.h>
-#ifndef __APPLE__
+#ifndef VGO_darwin
#include <malloc.h>
#endif
// but the files are actually the same (symlinked).
sprintf(out_name, "/tmp/racecheck_unittest_out.%d", getpid());
fd_out = creat(out_name, O_WRONLY | S_IRWXU);
-#ifdef __APPLE__
+#ifdef VGO_darwin
// symlink() is not supported on Darwin. Copy the output file name.
strcpy(in_name, out_name);
#else