summaryrefslogtreecommitdiff
path: root/kern/mutex.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-07-30 20:55:20 +0200
committerRichard Braun <rbraun@sceen.net>2018-07-30 20:55:20 +0200
commit5f202c9f744a5d9c5b751038edd2379b3d244227 (patch)
treec5bce5b9e1d9c4b01dfed4ff941ad9944814b93c /kern/mutex.h
parentd3e43f5bfda0bdad7a829a7ed8c1272a395b196b (diff)
Rework assertive functions
Instead of combining assertions and checking into single functions, rework those into pure checking functions usable with assert(). Those functions were introduced because of warnings about unused functions/variables caused by an earlier implementation of assert().
Diffstat (limited to 'kern/mutex.h')
-rw-r--r--kern/mutex.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/kern/mutex.h b/kern/mutex.h
index f446f5fe..0e6cd46c 100644
--- a/kern/mutex.h
+++ b/kern/mutex.h
@@ -23,6 +23,7 @@
#ifndef KERN_MUTEX_H
#define KERN_MUTEX_H
+#include <stdbool.h>
#include <stdint.h>
#if defined(CONFIG_MUTEX_ADAPTIVE)
@@ -47,7 +48,11 @@ mutex_init(struct mutex *mutex)
mutex_impl_init(mutex);
}
-#define mutex_assert_locked(mutex) mutex_impl_assert_locked(mutex)
+static inline bool
+mutex_locked(const struct mutex *mutex)
+{
+ return mutex_impl_locked(mutex);
+}
/*
* Attempt to lock the given mutex.