From 5b91cbdca17042f019c3fc35c61ac94d3654005b Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 26 Mar 2018 18:47:29 -0700 Subject: [PATCH] ircd::ctx: Add share counter observer to shared_mutex. --- include/ircd/ctx/shared_mutex.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/ircd/ctx/shared_mutex.h b/include/ircd/ctx/shared_mutex.h index f9808534b..02c5cfe31 100644 --- a/include/ircd/ctx/shared_mutex.h +++ b/include/ircd/ctx/shared_mutex.h @@ -25,6 +25,7 @@ class ircd::ctx::shared_mutex void release(); public: + size_t shares() const; size_t waiting() const; bool try_lock(); @@ -360,6 +361,13 @@ const return q.size(); } +inline size_t +ircd::ctx::shared_mutex::shares() +const +{ + return std::max(s, ssize_t(0)); +} + inline void ircd::ctx::shared_mutex::release() {