diff options
author | Sander Vrijders <[email protected]> | 2017-08-03 13:21:19 +0000 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-08-03 13:21:19 +0000 |
commit | 3b06d69d61cd677394fa7adf1ffcfa13ab8bac70 (patch) | |
tree | b071a0a3c396aa850a9024000a382165b0c00380 /src/lib/shm_rdrbuff.c | |
parent | b92eac2e9f6d686a9e2f748f8097aedbb373395c (diff) | |
parent | 5bb3bea07b0ff38e4646ed6f835d9bdac6beced6 (diff) | |
download | ouroboros-3b06d69d61cd677394fa7adf1ffcfa13ab8bac70.tar.gz ouroboros-3b06d69d61cd677394fa7adf1ffcfa13ab8bac70.zip |
Merged in sandervrijders/ouroboros/be-hurd (pull request #539)
build: Add check for robust mutexes
Diffstat (limited to 'src/lib/shm_rdrbuff.c')
-rw-r--r-- | src/lib/shm_rdrbuff.c | 14 |
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) |