refcount_release_take_##lock
John-Mark Gurney
jmg at funkthat.com
Fri Mar 13 23:58:39 UTC 2015
Mateusz Guzik wrote this message on Sat, Mar 14, 2015 at 00:16 +0100:
> In the meantime I wrote a new version.
>
> Apart from locking-handling primitives this time we get
> refcount_acquire_if_greater and refcount_release_if_greater helpers.
I don't see how this is of any benefit... The smallest value you can
provide is 0, which means the only time a reference can be obtained is
if the caller already has a reference. If you don't have a reference
(making it =0), it isn't safe to call this function on the object, as
it could be free'd, and point to a different type of object... Even if
you implement type-safe memory (which we shouldn't use more of), it's
less than ideal, since you then have to check if the object is the same
object you were expecting, and need to release it...
The release_if is even more problematic IMO...
After reading the previous discussion, I really don't like this. If
this gets approved (others override my objection), we need some docs
that say this should never be used, and it's use is only in the unsafe
case where the containing data structure does NOT have a reference to
the object.
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
More information about the freebsd-arch
mailing list