Module Name: src
Committed By: bouyer
Date: Tue Jun 7 13:52:31 UTC 2011
Modified Files:
src/sys/arch/xen/xenbus: xenbus_xs.c
Log Message:
check that the list is empty before calling cv_wait(). Otherwise
we may sleep waiting for an event which is already in the queue.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/xenbus/xenbus_xs.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/arch/xen/xenbus/xenbus_xs.c
diff -u src/sys/arch/xen/xenbus/xenbus_xs.c:1.19 src/sys/arch/xen/xenbus/xenbus_xs.c:1.20
--- src/sys/arch/xen/xenbus/xenbus_xs.c:1.19 Sun May 22 04:27:15 2011
+++ src/sys/arch/xen/xenbus/xenbus_xs.c Tue Jun 7 13:52:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_xs.c,v 1.19 2011/05/22 04:27:15 rmind Exp $ */
+/* $NetBSD: xenbus_xs.c,v 1.20 2011/06/07 13:52:30 bouyer Exp $ */
/******************************************************************************
* xenbus_xs.c
*
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenbus_xs.c,v 1.19 2011/05/22 04:27:15 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_xs.c,v 1.20 2011/06/07 13:52:30 bouyer Exp $");
#if 0
#define DPRINTK(fmt, args...) \
@@ -730,13 +730,15 @@
SIMPLEQ_INIT(&events_to_proces);
for (;;) {
mutex_enter(&watch_events_lock);
- cv_wait(&watch_cv, &watch_events_lock);
+ while (SIMPLEQ_EMPTY(&watch_events))
+ cv_wait(&watch_cv, &watch_events_lock);
SIMPLEQ_CONCAT(&events_to_proces, &watch_events);
mutex_exit(&watch_events_lock);
DPRINTK("xenwatch_thread: processing events");
while ((msg = SIMPLEQ_FIRST(&events_to_proces)) != NULL) {
+ DPRINTK("xenwatch_thread: got event");
SIMPLEQ_REMOVE_HEAD(&events_to_proces, msg_next);
msg->u.watch.handle->xbw_callback(
msg->u.watch.handle,