lib/ovs-atomic.h
/* Decrements 'refcount' and returns the previous reference count.  Often used
 * in this form:
 *
 * if (ovs_refcount_unref(&object->ref_cnt) == 1) {
 *     ...uninitialize object...
 *     free(object);
 * }
 *
 * Provides a release barrier making the preceding loads and stores to not be
 * reordered after the unref, and in case of the last reference provides also
 * an acquire barrier to keep all the following uninitialization from being
 * reordered before the atomic decrement operation.  Together these synchronize
 * any concurrent unref operations between each other. */
Decrements 'refcount' and returns the previous reference count.  Often used
in this form.



Provides a release barrier making the preceding loads and stores to not be
reordered after the unref, and in case of the last reference provides also
an acquire barrier to keep all the following uninitialization from being
reordered before the atomic decrement operation.  Together these synchronize
any concurrent unref operations between each other.
Decrements ' refcount ' and returns the previous reference count . Often used in this form . Provides a release barrier making the preceding loads and stores to not be reordered after the unref and in case of the last reference provides also an acquire barrier to keep all the following uninitialization from being reordered before the atomic decrement operation . Together these synchronize any concurrent unref operations between each other .
static inline unsigned int
ovs_refcount_unref(struct ovs_refcount *refcount)
{
    unsigned int old_refcount;
    atomic_sub_explicit(&refcount->count, 1u, &old_refcount,
                        memory_order_release);
    ovs_assert(old_refcount > 0);
    if (old_refcount == 1) {
        atomic_thread_fence(memory_order_acquire);
    }
    return old_refcount;
}
static inline unsigned int ovs_refcount_unref ( struct ovs_refcount * refcount ) { unsigned int old_refcount ; atomic_sub_explicit ( & refcount -> count , 1u , & old_refcount , memory_order_release ) ; ovs_assert ( old_refcount > 0 ) ; if ( old_refcount == 1 ) { atomic_thread_fence ( memory_order_acquire ) ; } return old_refcount ; }
Decrements 'refcount' and returns the previous reference count.
Decrements ' refcount ' and returns the previous reference count .
/* 'memory_order_release' above means that there are no (reordered)
         * accesses to the protected object from any thread at this point.
         * An acquire barrier is needed to keep all subsequent access to the
         * object's memory from being reordered before the atomic operation
         * above. */