Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/rump/librump/rumpkern/sleepq.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/rump/librump/rumpkern/sleepq.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.11.4.1 retrieving revision 1.12 diff -u -p -r1.11.4.1 -r1.12 --- src/sys/rump/librump/rumpkern/sleepq.c 2011/02/08 16:20:04 1.11.4.1 +++ src/sys/rump/librump/rumpkern/sleepq.c 2011/01/27 21:55:25 1.12 @@ -1,4 +1,4 @@ -/* $NetBSD: sleepq.c,v 1.11.4.1 2011/02/08 16:20:04 bouyer Exp $ */ +/* $NetBSD: sleepq.c,v 1.12 2011/01/27 21:55:25 pooka Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.11.4.1 2011/02/08 16:20:04 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.12 2011/01/27 21:55:25 pooka Exp $"); #include #include @@ -87,14 +87,12 @@ sleepq_block(int timo, bool catch) int biglocks = l->l_biglocks; while (l->l_wchan) { - l->l_mutex = mp; /* keep sleepq lock until woken up */ + l->l_mutex = mp; error = cv_timedwait(&sq_cv, mp, timo); if (error == EWOULDBLOCK || error == EINTR) { - if (l->l_wchan) { - TAILQ_REMOVE(l->l_sleepq, l, l_sleepchain); - l->l_wchan = NULL; - l->l_wmesg = NULL; - } + TAILQ_REMOVE(l->l_sleepq, l, l_sleepchain); + l->l_wchan = NULL; + l->l_wmesg = NULL; } } mutex_spin_exit(mp); @@ -120,6 +118,7 @@ sleepq_wake(sleepq_t *sq, wchan_t wchan, found = true; l->l_wchan = NULL; l->l_wmesg = NULL; + l->l_mutex = NULL; TAILQ_REMOVE(sq, l, l_sleepchain); } } @@ -136,6 +135,7 @@ sleepq_unsleep(struct lwp *l, bool clean l->l_wchan = NULL; l->l_wmesg = NULL; + l->l_mutex = NULL; TAILQ_REMOVE(l->l_sleepq, l, l_sleepchain); cv_broadcast(&sq_cv);