qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Race condition between signal handler and cpu_exec()


From: Jamie Lokier
Subject: Re: [Qemu-devel] Race condition between signal handler and cpu_exec()
Date: Fri, 6 Mar 2009 13:02:45 +0000
User-agent: Mutt/1.5.13 (2006-08-11)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]