Patchwork [10/19] add qemu_bh_scheduled

login
register
mail settings
Submitter Paolo Bonzini
Date Dec. 21, 2009, 8:09 a.m.
Message ID <1261382970-23251-11-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/41529/
State New
Headers show

Comments

Paolo Bonzini - Dec. 21, 2009, 8:09 a.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 async.c       |    5 +++++
 qemu-common.h |    2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

Patch

diff --git a/async.c b/async.c
index 57ac3a8..d58a1d5 100644
--- a/async.c
+++ b/async.c
@@ -188,6 +188,11 @@  void qemu_bh_cancel(QEMUBH *bh)
     bh->scheduled = 0;
 }
 
+bool qemu_bh_scheduled(QEMUBH *bh)
+{
+    return bh->scheduled && !bh->deleted;
+}
+
 void qemu_bh_delete(QEMUBH *bh)
 {
     bh->scheduled = 0;
diff --git a/qemu-common.h b/qemu-common.h
index 8630f8c..fac6a18 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -16,6 +16,7 @@ 
 
 /* we put basic includes here to avoid repeating them in device drivers */
 #include <stdlib.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
@@ -106,6 +107,7 @@  void qemu_bh_schedule(QEMUBH *bh);
  * iteration.
  */
 void qemu_bh_schedule_idle(QEMUBH *bh);
+bool qemu_bh_scheduled(QEMUBH *bh);
 void qemu_bh_cancel(QEMUBH *bh);
 void qemu_bh_delete(QEMUBH *bh);
 int qemu_bh_poll(void);