2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-03 07:45:30 +00:00

ovs-atomic: Add 64 bit apis.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Darrell Ball
2019-02-13 15:34:18 -08:00
committed by Ben Pfaff
parent 51b9a533e1
commit e981a45a6c

View File

@@ -479,6 +479,42 @@ atomic_count_set(atomic_count *count, unsigned int value)
atomic_store_relaxed(&count->count, value);
}
static inline uint64_t
atomic_count_inc64(atomic_uint64_t *counter)
{
uint64_t old;
atomic_add_relaxed(counter, 1ull, &old);
return old;
}
static inline uint64_t
atomic_count_dec64(atomic_uint64_t *counter)
{
uint64_t old;
atomic_sub_relaxed(counter, 1ull, &old);
return old;
}
static inline uint64_t
atomic_count_get64(atomic_uint64_t *counter)
{
uint64_t value;
atomic_read_relaxed(counter, &value);
return value;
}
static inline void
atomic_count_set64(atomic_uint64_t *counter, uint64_t value)
{
atomic_store_relaxed(counter, value);
}
/* Reference count. */
struct ovs_refcount {
atomic_uint count;