summaryrefslogtreecommitdiff
path: root/src/lib/shm_rbuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/shm_rbuff.c')
-rw-r--r--src/lib/shm_rbuff.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/shm_rbuff.c b/src/lib/shm_rbuff.c
index a206a019..b8db7c19 100644
--- a/src/lib/shm_rbuff.c
+++ b/src/lib/shm_rbuff.c
@@ -384,3 +384,23 @@ void shm_rbuff_fini(struct shm_rbuff * rb)
#endif
pthread_cleanup_pop(true);
}
+
+size_t shm_rbuff_queued(struct shm_rbuff * rb)
+{
+ size_t ret;
+
+ assert(rb);
+
+#ifdef __APPLE__
+ pthread_mutex_lock(rb->lock);
+#else
+ if (pthread_mutex_lock(rb->lock) == EOWNERDEAD)
+ pthread_mutex_consistent(rb->lock);
+#endif
+
+ ret = shm_rbuff_used(rb);
+
+ pthread_mutex_unlock(rb->lock);
+
+ return ret;
+}