aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/proc.h
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2008-02-07 06:55:38 +0000
committerJeff Roberson <jeff@FreeBSD.org>2008-02-07 06:55:38 +0000
commit626ac252ea74b60aa7b79f49b4162d24d4fa122d (patch)
treeed48bf7fe407074815ef781b08e0d5087d23a24a /sys/sys/proc.h
parent4a4e9652471a7062f599550e5193a6cf40869089 (diff)
downloadsrc-626ac252ea74b60aa7b79f49b4162d24d4fa122d.tar.gz
src-626ac252ea74b60aa7b79f49b4162d24d4fa122d.zip
- Add THREAD_LOCKPTR_ASSERT() to assert that the thread's lock points at
the provided lock or &blocked_lock. The thread may be temporarily assigned to the blocked_lock by the scheduler so a direct comparison can not always be made. - Use THREAD_LOCKPTR_ASSERT() in the primary consumers of the scheduling interfaces. The schedulers themselves still use more explicit asserts. Sponsored by: Nokia
Notes
Notes: svn path=/head/; revision=176078
Diffstat (limited to 'sys/sys/proc.h')
-rw-r--r--sys/sys/proc.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index e902166e1e0c..03a81423ea94 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -313,6 +313,17 @@ do { \
mtx_assert(__m, (type)); \
} while (0)
+#ifdef INVARIANTS
+#define THREAD_LOCKPTR_ASSERT(td, lock) \
+do { \
+ struct mtx *__m = (td)->td_lock; \
+ KASSERT((__m == &blocked_lock || __m == (lock)), \
+ ("Thread %p lock %p does not match %p", td, __m, (lock))); \
+} while (0)
+#else
+#define THREAD_LOCKPTR_ASSERT(td, lock)
+#endif
+
/*
* Flags kept in td_flags:
* To change these you MUST have the scheduler lock.