[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/19] qemu-char: remove use of QEMUTimer in favor o
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 12/19] qemu-char: remove use of QEMUTimer in favor of glib idle function |
Date: |
Mon, 18 Feb 2013 15:48:09 -0600 |
qemu-char is now independent of the QEMU main loop.
Signed-off-by: Anthony Liguori <address@hidden>
---
include/char/char.h | 2 +-
qemu-char.c | 12 +++++-------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/include/char/char.h b/include/char/char.h
index 09ac401..e8b781c 100644
--- a/include/char/char.h
+++ b/include/char/char.h
@@ -71,7 +71,7 @@ struct CharDriverState {
void (*chr_guest_open)(struct CharDriverState *chr);
void (*chr_guest_close)(struct CharDriverState *chr);
void *opaque;
- QEMUTimer *open_timer;
+ int idle_tag;
char *label;
char *filename;
int opened;
diff --git a/qemu-char.c b/qemu-char.c
index d3303e9..46d6509 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -122,20 +122,18 @@ void qemu_chr_be_event(CharDriverState *s, int event)
s->chr_event(s->handler_opaque, event);
}
-static void qemu_chr_fire_open_event(void *opaque)
+static gboolean qemu_chr_generic_open_bh(gpointer opaque)
{
CharDriverState *s = opaque;
qemu_chr_be_event(s, CHR_EVENT_OPENED);
- qemu_free_timer(s->open_timer);
- s->open_timer = NULL;
+ s->idle_tag = 0;
+ return FALSE;
}
void qemu_chr_generic_open(CharDriverState *s)
{
- if (s->open_timer == NULL) {
- s->open_timer = qemu_new_timer_ms(rt_clock,
- qemu_chr_fire_open_event, s);
- qemu_mod_timer(s->open_timer, qemu_get_clock_ms(rt_clock) - 1);
+ if (s->idle_tag == 0) {
+ s->idle_tag = g_idle_add(qemu_chr_generic_open_bh, s);
}
}
--
1.8.0
- [Qemu-devel] [PATCH 00/19] chardev flow control, Anthony Liguori, 2013/02/19
- [Qemu-devel] [PATCH 07/19] qemu-char: tcp: make use GIOChannel, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 08/19] qemu-char: add watch support, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 06/19] qemu-char: convert UDP to GIOChannel, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 09/19] qemu-char: add pty watch, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 10/19] char: add gio watch fn for tcp backends, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 11/19] qemu-char: use a glib timeout instead of qemu-timer, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 12/19] qemu-char: remove use of QEMUTimer in favor of glib idle function,
Anthony Liguori <=
- [Qemu-devel] [PATCH 13/19] qemu-char: make char drivers dynamically registerable, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 14/19] qemu-char: move spice registration to spice-qemu-char.c, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 19/19] virtio: console: add flow control, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 18/19] serial: add flow control to transmit, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 15/19] qemu-char: move baum registration to baum.c, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 16/19] qemu-char: move msmouse registeration to msmouse.c, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 17/19] qemu-char: move text console init to console.c, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 02/19] qemu-char: remove dead/confusing logic with nb_stdio_clients, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 04/19] qemu-char: convert fd_chr to use a GIOChannel, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 05/19] qemu-char: convert pty to GIOChannel, Anthony Liguori, 2013/02/19