diff mbox

[09/10] coroutine: schedule timeout coroutine instead process it directly

Message ID 1333442297-18932-9-git-send-email-laijs@cn.fujitsu.com
State New
Headers show

Commit Message

Lai Jiangshan April 3, 2012, 8:38 a.m. UTC
Avoid a timer callback spends too much time.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 qemu-coroutine-sleep.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Paolo Bonzini April 3, 2012, 11:26 a.m. UTC | #1
Il 03/04/2012 10:38, Lai Jiangshan ha scritto:
> Avoid a timer callback spends too much time.
> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
>  qemu-coroutine-sleep.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/qemu-coroutine-sleep.c b/qemu-coroutine-sleep.c
> index fd65274..df9254a 100644
> --- a/qemu-coroutine-sleep.c
> +++ b/qemu-coroutine-sleep.c
> @@ -24,7 +24,7 @@ static void co_sleep_cb(void *opaque)
>      CoSleepCB *sleep_cb = opaque;
>  
>      qemu_free_timer(sleep_cb->ts);
> -    qemu_coroutine_enter(sleep_cb->co, NULL);
> +    qemu_co_runnable_schedule(sleep_cb->co);
>  }
>  
>  void coroutine_fn co_sleep_ns(QEMUClock *clock, int64_t ns)

Why is this important?

Also, why should it be different for timers, fd_handlers (used for
example by NBD) and bottom halves (used for AIO callbacks)?

Paolo
diff mbox

Patch

diff --git a/qemu-coroutine-sleep.c b/qemu-coroutine-sleep.c
index fd65274..df9254a 100644
--- a/qemu-coroutine-sleep.c
+++ b/qemu-coroutine-sleep.c
@@ -24,7 +24,7 @@  static void co_sleep_cb(void *opaque)
     CoSleepCB *sleep_cb = opaque;
 
     qemu_free_timer(sleep_cb->ts);
-    qemu_coroutine_enter(sleep_cb->co, NULL);
+    qemu_co_runnable_schedule(sleep_cb->co);
 }
 
 void coroutine_fn co_sleep_ns(QEMUClock *clock, int64_t ns)