[Top][All Lists]

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

Re: [Qemu-devel] [PATCH] qom: Use atomics for object refcounting

From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] qom: Use atomics for object refcounting
Date: Tue, 02 Jul 2013 13:28:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

Il 02/07/2013 13:15, Andreas Färber ha scritto:
>> > @@ -683,16 +683,15 @@ GSList *object_class_get_list(const char 
>> > *implements_type,
>> >  
>> >  void object_ref(Object *obj)
>> >  {
>> > -    obj->ref++;
>> > +     __sync_fetch_and_add(&obj->ref, 1);
> How widespread are these in GCC/clang? Is there any fallback? I remember
> seeing some __sync_* warnings on Mac OS X around 4.2...

We are using them already in several places (vhost was the first one to
introduce them, I think, but now they are also in migration ad in some
tests too).  There is no fallback (asm could be a fallback, but we chose
to require GCC 4.2 or newer).

I'll change this to atomic_inc/dec when applying.  Otherwise

Reviewed-by: Paolo Bonzini <address@hidden>


reply via email to

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