summaryrefslogtreecommitdiff
path: root/src/lib/shm_rdrbuff.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2017-08-04 04:40:30 -0600
committerDimitri Staessens <dimitri.staessens@ugent.be>2017-08-04 04:40:30 -0600
commit6464bb4b9759b10aa144af2edf98a898a60256c7 (patch)
treecf80113aee8408b68f845ed7467cce3a8e5bb657 /src/lib/shm_rdrbuff.c
parent6eb3105f908158130bbc415e7376e3c2d7aafb5e (diff)
parentf85c70fdb6dbbadb903155120892e55b0eff5dda (diff)
downloadouroboros-6464bb4b9759b10aa144af2edf98a898a60256c7.tar.gz
ouroboros-6464bb4b9759b10aa144af2edf98a898a60256c7.zip
Merge branch 'be' of bitbucket.com:dstaesse/ouroboros into be
Diffstat (limited to 'src/lib/shm_rdrbuff.c')
-rw-r--r--src/lib/shm_rdrbuff.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c
index 1f999f93..d454fef8 100644
--- a/src/lib/shm_rdrbuff.c
+++ b/src/lib/shm_rdrbuff.c
@@ -192,7 +192,7 @@ struct shm_rdrbuff * shm_rdrbuff_create()
pthread_mutexattr_init(&mattr);
pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
-#ifndef __APPLE__
+#ifdef HAVE_ROBUST_MUTEX
pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST);
#endif
pthread_mutex_init(rdrb->lock, &mattr);
@@ -274,7 +274,7 @@ int shm_rdrbuff_wait_full(struct shm_rdrbuff * rdrb,
ts_add(&abstime, timeo, &abstime);
}
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rdrb->lock);
#else
if (pthread_mutex_lock(rdrb->lock) == EOWNERDEAD)
@@ -282,9 +282,9 @@ int shm_rdrbuff_wait_full(struct shm_rdrbuff * rdrb,
#endif
while (shm_rdrb_free(rdrb, WAIT_BLOCKS)) {
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
if (pthread_cond_timedwait(rdrb->full,
- rdrb->lock
+ rdrb->lock,
&abstime) == ETIMEDOUT) {
pthread_mutex_unlock(rdrb->lock);
return -ETIMEDOUT;
@@ -358,7 +358,7 @@ ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb,
if (sz > SHM_RDRB_BLOCK_SIZE)
return -EMSGSIZE;
#endif
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rdrb->lock);
#else
if (pthread_mutex_lock(rdrb->lock) == EOWNERDEAD)
@@ -437,7 +437,7 @@ ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb,
if (sz > SHM_RDRB_BLOCK_SIZE)
return -EMSGSIZE;
#endif
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rdrb->lock);
#else
if (pthread_mutex_lock(rdrb->lock) == EOWNERDEAD)
@@ -535,7 +535,7 @@ int shm_rdrbuff_remove(struct shm_rdrbuff * rdrb,
assert(rdrb);
assert(idx < (SHM_BUFFER_SIZE));
-#ifdef __APPLE__
+#ifndef HAVE_ROBUST_MUTEX
pthread_mutex_lock(rdrb->lock);
#else
if (pthread_mutex_lock(rdrb->lock) == EOWNERDEAD)