From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v5 01/15] coroutine: add co_sleep_ns() coroutine sleep function
Date: Tue, 17 Jan 2012 14:38:48 +0100 [thread overview]
Message-ID: <4F1579E8.5000007@redhat.com> (raw)
In-Reply-To: <CAJSP0QXBUCuqowqPDTHo=ZDFptthDXLWBwTbw1bV0hWv9zf_ZA@mail.gmail.com>
Am 17.01.2012 14:31, schrieb Stefan Hajnoczi:
> On Tue, Jan 17, 2012 at 12:54 PM, Kevin Wolf <kwolf@redhat.com> wrote:
>> Am 13.01.2012 14:14, schrieb Stefan Hajnoczi:
>>> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
>>> ---
>>> Makefile.objs | 1 +
>>> qemu-coroutine-sleep.c | 38 ++++++++++++++++++++++++++++++++++++++
>>> qemu-coroutine.h | 9 +++++++++
>>> 3 files changed, 48 insertions(+), 0 deletions(-)
>>> create mode 100644 qemu-coroutine-sleep.c
>>>
>>> diff --git a/Makefile.objs b/Makefile.objs
>>> index 4f6d26c..f4f52e0 100644
>>> --- a/Makefile.objs
>>> +++ b/Makefile.objs
>>> @@ -13,6 +13,7 @@ oslib-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o
>>> #######################################################################
>>> # coroutines
>>> coroutine-obj-y = qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o
>>> +coroutine-obj-y += qemu-coroutine-sleep.o
>>> ifeq ($(CONFIG_UCONTEXT_COROUTINE),y)
>>> coroutine-obj-$(CONFIG_POSIX) += coroutine-ucontext.o
>>> else
>>> diff --git a/qemu-coroutine-sleep.c b/qemu-coroutine-sleep.c
>>> new file mode 100644
>>> index 0000000..fd65274
>>> --- /dev/null
>>> +++ b/qemu-coroutine-sleep.c
>>> @@ -0,0 +1,38 @@
>>> +/*
>>> + * QEMU coroutine sleep
>>> + *
>>> + * Copyright IBM, Corp. 2011
>>> + *
>>> + * Authors:
>>> + * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
>>> + *
>>> + * This work is licensed under the terms of the GNU LGPL, version 2 or later.
>>> + * See the COPYING.LIB file in the top-level directory.
>>> + *
>>> + */
>>> +
>>> +#include "qemu-coroutine.h"
>>> +#include "qemu-timer.h"
>>> +
>>> +typedef struct CoSleepCB {
>>> + QEMUTimer *ts;
>>> + Coroutine *co;
>>> +} CoSleepCB;
>>> +
>>> +static void co_sleep_cb(void *opaque)
>>> +{
>>> + CoSleepCB *sleep_cb = opaque;
>>> +
>>> + qemu_free_timer(sleep_cb->ts);
>>
>> I think you need to call qemu_del_timer() first.
>
> I think we're okay with just qemu_free_timer(). qemu_run_timers()
> removes the timer from the active_timers list before invoking its
> callback. qemu_del_timer() is not needed because it just searches the
> active_timers list and removes the timer, if found. We're no longer
> on the active_timers list at the point when co_sleep_cb() is called,
> so there's no need.
Yes, seems you're right. qemu_del_timer() isn't a good name...
Kevin
next prev parent reply other threads:[~2012-01-17 13:36 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 13:14 [Qemu-devel] [PATCH v5 00/15] block: generic image streaming Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 01/15] coroutine: add co_sleep_ns() coroutine sleep function Stefan Hajnoczi
2012-01-17 12:54 ` Kevin Wolf
2012-01-17 13:31 ` Stefan Hajnoczi
2012-01-17 13:38 ` Kevin Wolf [this message]
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 02/15] block: check bdrv_in_use() before blockdev operations Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 03/15] block: add BlockJob interface for long-running operations Stefan Hajnoczi
2012-01-17 13:00 ` Kevin Wolf
2012-01-17 13:33 ` Stefan Hajnoczi
2012-01-17 13:44 ` Kevin Wolf
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 04/15] block: add image streaming block job Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 05/15] block: rate-limit streaming operations Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 06/15] qmp: add block_stream command Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 07/15] qmp: add block_job_set_speed command Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 08/15] qmp: add block_job_cancel command Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 09/15] qmp: add query-block-jobs Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 10/15] blockdev: make image streaming safe across hotplug Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 11/15] block: add bdrv_find_backing_image Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 12/15] add QERR_BASE_NOT_FOUND Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 13/15] block: add support for partial streaming Stefan Hajnoczi
2012-01-17 13:27 ` Kevin Wolf
2012-01-17 13:50 ` Marcelo Tosatti
2012-01-17 14:05 ` Kevin Wolf
2012-01-17 15:47 ` Marcelo Tosatti
2012-01-17 15:55 ` Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 14/15] docs: describe live block operations Stefan Hajnoczi
2012-01-13 13:14 ` [Qemu-devel] [PATCH v5 15/15] test: add image streaming test cases Stefan Hajnoczi
2012-01-13 16:49 ` Stefan Hajnoczi
2012-01-17 19:07 ` Lucas Meneghel Rodrigues
2012-01-18 8:47 ` Stefan Hajnoczi
2012-01-16 11:20 ` [Qemu-devel] [PATCH v5 00/15] block: generic image streaming Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F1579E8.5000007@redhat.com \
--to=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=stefanha@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.