From 6767c6547b4b6174ad16d3714700ea33e51a0977 Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Sun, 1 Feb 2004 01:24:54 +0000 Subject: [PATCH] - Assert that td_critnest > 0 in critical_exit() to catch cases of unbalanced uses of the critical_* api. --- sys/kern/kern_switch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index ee38e88d9fcd..a8ead79984d7 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -443,6 +443,8 @@ critical_exit(void) { struct thread *td; + KASSERT(td->td_critnest > 0, + ("critical_exit: critnest < 0")); td = curthread; if (td->td_critnest == 1) { td->td_critnest = 0;