From: Paolo Bonzini <bonzini@gnu.org>
To: Glauber Costa <glommer@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [RFC] queue_work proposal
Date: Thu, 03 Sep 2009 09:36:09 +0200 [thread overview]
Message-ID: <4A9F71E9.3090900@gnu.org> (raw)
In-Reply-To: <1251939158-17153-1-git-send-email-glommer@redhat.com>
> + env->queued_total++;
> +
> + if (env == qemu_get_current_env()) {
> + env->queued_total++;
Why increment twice? (though queued_total is write only and queued_local
is unused, so...)
> + func(data);
> + return;
> + }
> +
> + wii = qemu_mallocz(sizeof(*wii));
> + wii->func = func;
> + wii->data = data;
> + wii->wait = wait;
> + TAILQ_INSERT_TAIL(&env->queued_work, wii, entry);
> +
> + qemu_thread_signal(env->thread, SIGUSR1);
> +
> + while (wait&& !wii->done) {
> + qemu_cond_wait(env->work_cond,&qemu_global_mutex);
> + }
You need to lock qemu_global_mutex around this while statement, or to
add env->queue_mutex and include the TAILQ_INSERT_TAIL in the mutex.
Paolo
next prev parent reply other threads:[~2009-09-03 7:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-03 0:52 [Qemu-devel] [RFC] queue_work proposal Glauber Costa
2009-09-03 7:36 ` Paolo Bonzini [this message]
2009-09-03 11:07 ` [Qemu-devel] " Glauber Costa
2009-09-03 8:45 ` [Qemu-devel] " Avi Kivity
2009-09-03 11:15 ` Glauber Costa
2009-09-03 11:32 ` Avi Kivity
2009-09-03 12:11 ` Glauber Costa
2009-09-03 13:43 ` Avi Kivity
2009-09-03 16:46 ` Glauber Costa
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=4A9F71E9.3090900@gnu.org \
--to=bonzini@gnu.org \
--cc=aliguori@us.ibm.com \
--cc=glommer@redhat.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).