Re: [Qemu-devel] [PATCH v7 1/7] qom: apply atomic on object's refcount

2012-11-29 Thread liu ping fan
On Thu, Nov 29, 2012 at 1:16 AM, Richard Henderson wrote: > On 11/24/2012 06:02 PM, Liu Ping Fan wrote: >> -obj->ref--; >> >> /* parent always holds a reference to its children */ >> -if (obj->ref == 0) { >> +if (__sync_fetch_and_sub(&obj->ref, 1) == 1) { > > if (__sync_sub_and_

Re: [Qemu-devel] [PATCH v7 1/7] qom: apply atomic on object's refcount

2012-11-28 Thread Richard Henderson
On 11/24/2012 06:02 PM, Liu Ping Fan wrote: > -obj->ref--; > > /* parent always holds a reference to its children */ > -if (obj->ref == 0) { > +if (__sync_fetch_and_sub(&obj->ref, 1) == 1) { if (__sync_sub_and_fetch(&obj->ref, 1) == 0) r~

[Qemu-devel] [PATCH v7 1/7] qom: apply atomic on object's refcount

2012-11-24 Thread Liu Ping Fan
From: Liu Ping Fan Signed-off-by: Liu Ping Fan --- qom/object.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/qom/object.c b/qom/object.c index e3e9242..1a697b3 100644 --- a/qom/object.c +++ b/qom/object.c @@ -600,16 +600,15 @@ GSList *object_class_get_list(const