summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2012-11-17 20:48:48 +0100
committerRichard Braun <rbraun@sceen.net>2012-11-17 20:49:38 +0100
commit426d69f9c87875cc8d6b48f1f096f904c1998896 (patch)
treefb2fec3f44c0a9299ed4810bbd062b3878d58c71 /kern
parent3119195c519d1289362b9530785709b6a398590e (diff)
kern/spinlock: new spinlock_assert_locked function
Diffstat (limited to 'kern')
-rw-r--r--kern/spinlock.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/kern/spinlock.h b/kern/spinlock.h
index 6ae3ed6b..2839aac1 100644
--- a/kern/spinlock.h
+++ b/kern/spinlock.h
@@ -24,6 +24,7 @@
#ifndef _KERN_SPINLOCK_H
#define _KERN_SPINLOCK_H
+#include <kern/assert.h>
#include <machine/atomic.h>
#include <machine/cpu.h>
@@ -45,6 +46,12 @@ spinlock_init(struct spinlock *lock)
lock->locked = 0;
}
+static inline int
+spinlock_assert_locked(struct spinlock *lock)
+{
+ assert(lock->locked);
+}
+
/*
* Attempt to acquire a spin lock.
*