From: Peter Maydell <peter.maydell@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kwolf@redhat.com, stefanha@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] coroutine: always use pooling
Date: Wed, 26 Sep 2012 15:34:57 +0100 [thread overview]
Message-ID: <CAFEAcA8=uonjFpLQx0ykx5AdBQw0ytbY2EwAy3p_XFX6PayzJQ@mail.gmail.com> (raw)
In-Reply-To: <1348577046-12643-1-git-send-email-pbonzini@redhat.com>
On 25 September 2012 13:44, Paolo Bonzini <pbonzini@redhat.com> wrote:
> It makes sense to use it for other implementations than ucontext, too.
> Coroutine *qemu_coroutine_create(CoroutineEntry *entry)
> {
> - Coroutine *co = qemu_coroutine_new();
> + Coroutine *co;
> +
> + co = QSLIST_FIRST(&pool);
> + if (co) {
> + QSLIST_REMOVE_HEAD(&pool, pool_next);
> + pool_size--;
> + } else {
> + co = qemu_coroutine_new();
> + }
> co->entry = entry;
> return co;
> }
Since this is obviously going to blow up badly if it's called
from multiple threads, is there some kind of assert we can add
so that we fail obviously if somebody makes that coding error?
[the difficulty is probably when your backend is the gthread
one, at least I assume creating a coroutine inside a coroutine
is allowed.]
-- PMM
next prev parent reply other threads:[~2012-09-26 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-25 12:44 [Qemu-devel] [PATCH] coroutine: always use pooling Paolo Bonzini
2012-09-26 14:34 ` Peter Maydell [this message]
2012-09-26 15:18 ` Paolo Bonzini
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='CAFEAcA8=uonjFpLQx0ykx5AdBQw0ytbY2EwAy3p_XFX6PayzJQ@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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 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).