mirror of
https://github.com/openvswitch/ovs
synced 2025-09-03 15:55:19 +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:
@@ -479,6 +479,42 @@ atomic_count_set(atomic_count *count, unsigned int value)
|
|||||||
atomic_store_relaxed(&count->count, 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. */
|
/* Reference count. */
|
||||||
struct ovs_refcount {
|
struct ovs_refcount {
|
||||||
atomic_uint count;
|
atomic_uint count;
|
||||||
|
Reference in New Issue
Block a user