[zeromq-dev] atomic ops
Luca Fascione
lukes at wetafx.co.nz
Thu Feb 9 02:53:34 CET 2012
I agree with everything else you said,
but I'm not sure I understand why this is lock free... (I see it has no
mutex locks, indeed...)
Couldn't you have an infinite pingpong of a couple threads starving each
other, because they never manage to agree on what the refcount should be?
(as in they cause each other's check of the ref count to fail forever)
Luca
On 09/02/12 14:34, john skaller wrote:
> The standard "lock free" way to do this is to do a tentative transfer
> and then check it succeeded. Eg you increment the ref count then grab
> the pointer then you check the refcount is what you set it to. If not,
> you retry, unless it dropped to zero in which case you're screwed.
--
Luca Fascione
Rendering Research Lead - Weta Digital
Phone: +64 4 909 6870 (x6870)
Mobile: +64 21 0764 862
More information about the zeromq-dev
mailing list