summaryrefslogtreecommitdiffstats
path: root/include/linux/rtmutex.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-08-15 23:28:02 +0200
committerIngo Molnar <mingo@kernel.org>2021-08-17 17:04:35 +0200
commit6bc8996add9f82d0153b0be44efe282bd45dc702 (patch)
tree086acd6d4d75f32ddd0dbf5212b0462a447351af /include/linux/rtmutex.h
parentebbdc41e90ffce8b6bb3cbba1801ede2dd07a89b (diff)
downloadlinux-6bc8996add9f82d0153b0be44efe282bd45dc702.tar.gz
linux-6bc8996add9f82d0153b0be44efe282bd45dc702.tar.bz2
linux-6bc8996add9f82d0153b0be44efe282bd45dc702.zip
locking/rtmutex: Provide rt_mutex_base_is_locked()
Provide rt_mutex_base_is_locked(), which will be used for various wrapped locking primitives for RT. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20210815211302.899572818@linutronix.de
Diffstat (limited to 'include/linux/rtmutex.h')
-rw-r--r--include/linux/rtmutex.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 852740285d71..174419ee58e9 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -13,6 +13,7 @@
#ifndef __LINUX_RT_MUTEX_H
#define __LINUX_RT_MUTEX_H
+#include <linux/compiler.h>
#include <linux/linkage.h>
#include <linux/rbtree.h>
#include <linux/spinlock_types.h>
@@ -32,6 +33,17 @@ struct rt_mutex_base {
.owner = NULL \
}
+/**
+ * rt_mutex_base_is_locked - is the rtmutex locked
+ * @lock: the mutex to be queried
+ *
+ * Returns true if the mutex is locked, false if unlocked.
+ */
+static inline bool rt_mutex_base_is_locked(struct rt_mutex_base *lock)
+{
+ return READ_ONCE(lock->owner) != NULL;
+}
+
extern void rt_mutex_base_init(struct rt_mutex_base *rtb);
/**