qemu-devel
[Top][All Lists]
Advanced

[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 14:00:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

Il 02/07/2013 13:52, Jan Kiszka ha scritto:
>>> But then atomic_dec_and_test or so. Letting the inc/dec return some
>>> >> value leaves room for interpretations (value of before or after the
>>> >> modification?).
>> > 
>> > In qemu, I made all atomic_* functions return the old value.  This is
>> > consistent with atomic_cmpxchg and atomic_xchg (where returning the new
>> > value makes no sense).
> Please avoid this ambiguity by naming the functions properly. That xchg
> returns old values is known, that dec and inc do, is surely not.

IMO the ambiguity is resolved simply by looking at the docs or existing
code, but I can rename them to atomic_fetch_{add,sub,and,or,inc,dec} and
add void versions without "fetch".

Paolo



reply via email to

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