Module Name:    src
Committed By:   pooka
Date:           Thu Apr 24 11:56:11 UTC 2014

Modified Files:
        src/sys/rump/librump/rumpkern: sleepq.c

Log Message:
in sleepq_wake(), honor the "expected" parameter


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/rump/librump/rumpkern/sleepq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/librump/rumpkern/sleepq.c
diff -u src/sys/rump/librump/rumpkern/sleepq.c:1.14 src/sys/rump/librump/rumpkern/sleepq.c:1.15
--- src/sys/rump/librump/rumpkern/sleepq.c:1.14	Sun Mar 10 11:21:05 2013
+++ src/sys/rump/librump/rumpkern/sleepq.c	Thu Apr 24 11:56:11 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sleepq.c,v 1.14 2013/03/10 11:21:05 pooka Exp $	*/
+/*	$NetBSD: sleepq.c,v 1.15 2014/04/24 11:56:11 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.14 2013/03/10 11:21:05 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.15 2014/04/24 11:56:11 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/condvar.h>
@@ -105,9 +105,6 @@ sleepq_wake(sleepq_t *sq, wchan_t wchan,
 	struct lwp *l, *l_next;
 	bool found = false;
 
-	if (__predict_false(expected != -1))
-		panic("sleepq_wake: \"expected\" not supported");
-
 	for (l = TAILQ_FIRST(sq); l; l = l_next) {
 		l_next = TAILQ_NEXT(l, l_sleepchain);
 		if (l->l_wchan == wchan) {
@@ -115,6 +112,8 @@ sleepq_wake(sleepq_t *sq, wchan_t wchan,
 			l->l_wchan = NULL;
 			l->l_wmesg = NULL;
 			TAILQ_REMOVE(sq, l, l_sleepchain);
+			if (--expected == 0)
+				break;
 		}
 	}
 	if (found)

Reply via email to