qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v5 07/18] qemu-thread: add simple test-and-set s


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v5 07/18] qemu-thread: add simple test-and-set spinlock
Date: Wed, 18 May 2016 16:40:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0


On 18/05/2016 16:10, Sergey Fedorov wrote:
> On 18/05/16 17:05, Paolo Bonzini wrote:
>> this:
>>
>>   if (atomic_read(&x) != 1) {
>>     atomic_set(&x, 1);
>>   }
>>
>> couldn't become an unconditional
>>
>>   atomic_set(&x, 1);
> 
> Sorry, I can't figure out why it couldn't...

Because atomics cannot create new unconditional writes (and neither can
volatile).

Thanks,

paolo



reply via email to

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