]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/valgrind/src/valgrind-3.6.0-svn/drd/tests/pth_inconsistent_cond_wait.c
update
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / drd / tests / pth_inconsistent_cond_wait.c
index 618b5401aaaa1a3deb11e14f451aa8af5ae7cfe9..fb95fd8a910f85532c447d1f382c486dee27ca12 100644 (file)
@@ -44,8 +44,14 @@ static int             s_quiet;
 
 static sem_t* create_semaphore(const char* const name)
 {
-#ifdef __APPLE__
-  sem_t* p = sem_open(name, O_CREAT, 0600, 0);
+#ifdef VGO_darwin
+  char name_and_pid[32];
+  snprintf(name_and_pid, sizeof(name_and_pid), "%s-%d", name, getpid());
+  sem_t* p = sem_open(name_and_pid, O_CREAT | O_EXCL, 0600, 0);
+  if (p == SEM_FAILED) {
+    perror("sem_open");
+    return NULL;
+  }
   return p;
 #else
   sem_t* p = malloc(sizeof(*p));
@@ -57,7 +63,7 @@ static sem_t* create_semaphore(const char* const name)
 
 static void destroy_semaphore(const char* const name, sem_t* p)
 {
-#ifdef __APPLE__
+#ifdef VGO_darwin
   sem_close(p);
   sem_unlink(name);
 #else