summaryrefslogtreecommitdiff
path: root/src/lib/shm_flow_set.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-08-03 14:51:41 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-08-03 15:19:16 +0200
commit5bb3bea07b0ff38e4646ed6f835d9bdac6beced6 (patch)
treeb071a0a3c396aa850a9024000a382165b0c00380 /src/lib/shm_flow_set.c
parentb92eac2e9f6d686a9e2f748f8097aedbb373395c (diff)
downloadouroboros-5bb3bea07b0ff38e4646ed6f835d9bdac6beced6.tar.gz
ouroboros-5bb3bea07b0ff38e4646ed6f835d9bdac6beced6.zip
build: Add check for robust mutexes
This adds a check for robust mutexes. The constant HAVE_ROBUST_MUTEX is set accordingly in config.h. It also adds some other fixes to make the prototype compile on the Hurd.
Diffstat (limited to 'src/lib/shm_flow_set.c')
-rw-r--r--src/lib/shm_flow_set.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c
index 67abbb5b..7660b1dd 100644
--- a/src/lib/shm_flow_set.c
+++ b/src/lib/shm_flow_set.c
@@ -117,7 +117,7 @@ struct shm_flow_set * shm_flow_set_create()
(set->fqueues + AP_MAX_FQUEUES * (SHM_BUFFER_SIZE));
pthread_mutexattr_init(&mattr);
-#ifndef __APPLE__
+#ifdef HAVE_ROBUST_MUTEX
pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST);
#endif
pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
@@ -336,7 +336,7 @@ ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
assert(idx < AP_MAX_FQUEUES);
assert(fqueue);
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(set->lock);
#else
if (pthread_mutex_lock(set->lock) == EOWNERDEAD)
@@ -358,7 +358,7 @@ ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
else
ret = -pthread_cond_wait(set->conds + idx,
set->lock);
-#ifndef __APPLE__
+#ifdef HAVE_ROBUST_MUTEX
if (ret == -EOWNERDEAD)
pthread_mutex_consistent(set->lock);
#endif