qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Julian Seward <jseward@acm.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Race condition between signal handler and cpu_exec()
Date: Fri, 6 Mar 2009 13:02:45 +0000	[thread overview]
Message-ID: <20090306130245.GA24685@shareable.org> (raw)
In-Reply-To: <200903061249.29263.jseward@acm.org>

Julian Seward wrote:
> On Friday 06 March 2009, Jamie Lokier wrote:
> > Aurelien Jarno wrote:
> > > I am currently too tired to find a proper solution (which should only
> > > use read/write to a variable to keep the operations atomic), I'll look
> > > at that tomorrow, but patches are welcome in the meanwhile.
> >
> > The theoretically right thing in C is read/write a "volatile
> > sig_atomic_t".
> 
> It looks to me like this requires to atomically test that a bit in a
> byte is set, and if so clear it.

No, it only requires that if you keep with the same representation.

If you move that bit into its very own variable, just for the one bit,
you can read/write the whole variable.  _That's_ portable (assuming a
suitable variable type is used).

-- Jamie

      parent reply	other threads:[~2009-03-06 13:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-05 22:14 [Qemu-devel] Race condition between signal handler and cpu_exec() Aurelien Jarno
2009-03-06  1:05 ` Jamie Lokier
2009-03-06 11:49   ` Julian Seward
2009-03-06 12:30     ` malc
2009-03-06 13:02     ` Jamie Lokier [this message]

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=20090306130245.GA24685@shareable.org \
    --to=jamie@shareable.org \
    --cc=jseward@acm.org \
    --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).