Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xenbus check that the list is empty before call...



details:   https://anonhg.NetBSD.org/src/rev/a52f0185793f
branches:  trunk
changeset: 765832:a52f0185793f
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Jun 07 13:52:30 2011 +0000

description:
check that the list is empty before calling cv_wait(). Otherwise
we may sleep waiting for an event which is already in the queue.

diffstat:

 sys/arch/xen/xenbus/xenbus_xs.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 556fcd8a5602 -r a52f0185793f sys/arch/xen/xenbus/xenbus_xs.c
--- a/sys/arch/xen/xenbus/xenbus_xs.c   Tue Jun 07 13:51:52 2011 +0000
+++ b/sys/arch/xen/xenbus/xenbus_xs.c   Tue Jun 07 13:52:30 2011 +0000
@@ -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,



Home | Main Index | Thread Index | Old Index