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