From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: "Peter A. G. Crosthwaite" <peter.crosthwaite@petalogix.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-coroutine: Add simple work queue support
Date: Wed, 24 Aug 2011 13:08:26 +0100 [thread overview]
Message-ID: <20110824120826.GA4968@stefanha-thinkpad.localdomain> (raw)
In-Reply-To: <1314172671-13123-1-git-send-email-peter.crosthwaite@petalogix.com>
On Wed, Aug 24, 2011 at 05:57:51PM +1000, Peter A. G. Crosthwaite wrote:
> Add a function co_queue_yield_to_next() which will immediately transfer
> control to the coroutine at the head of a co queue. This can be used for
> implementing simple work queues where the manager of a co-queue only
> needs to restart queued routines one at a time.
>
> Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
> ---
> qemu-coroutine-lock.c | 13 +++++++++++++
> qemu-coroutine.h | 9 +++++++++
> 2 files changed, 22 insertions(+), 0 deletions(-)
Please share code that uses this function, even if it's not suitable for
merging. I'd like to understand what the pattern for using this
function is.
> diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c
> index a80f437..de2fc21 100644
> --- a/qemu-coroutine-lock.c
> +++ b/qemu-coroutine-lock.c
> @@ -75,6 +75,19 @@ bool qemu_co_queue_next(CoQueue *queue)
> return (next != NULL);
> }
>
> +bool qemu_co_queue_yield_to_next(CoQueue *queue)
This function can only be executed in coroutine context (i.e. it cannot
be executed outside a coroutine). Therefore please use the coroutine_fn
annotation. Perhaps we'll hook the annotation up with a checker in the
future to ensure that non-coroutine_fn functions never call coroutine_fn
functions statically at build time. In the meantime it serves as
documentation.
Stefan
next prev parent reply other threads:[~2011-08-24 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-24 7:57 [Qemu-devel] [PATCH] qemu-coroutine: Add simple work queue support Peter A. G. Crosthwaite
2011-08-24 12:08 ` Stefan Hajnoczi [this message]
2011-08-25 6:46 ` Peter Crosthwaite
2011-08-25 8:06 ` Stefan Hajnoczi
2011-09-05 13:23 ` Kevin Wolf
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=20110824120826.GA4968@stefanha-thinkpad.localdomain \
--to=stefanha@linux.vnet.ibm.com \
--cc=kwolf@redhat.com \
--cc=peter.crosthwaite@petalogix.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).