1 #ifndef LTTNG_REF_INTERNAL_H
2 #define LTTNG_REF_INTERNAL_H
5 * LTTng - Non thread-safe reference counting
7 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 * SPDX-License-Identifier: LGPL-2.1-only
13 using lttng_release_func = void (*)(void *);
17 lttng_release_func release;
20 static inline void lttng_ref_init(struct lttng_ref *ref, lttng_release_func release)
24 ref->release = release;
27 static inline void lttng_ref_get(struct lttng_ref *ref)
32 LTTNG_ASSERT(ref->count);
35 static inline void lttng_ref_put(struct lttng_ref *ref)
38 /* Underflow check. */
39 LTTNG_ASSERT(ref->count);
40 if (caa_unlikely((--ref->count) == 0)) {
45 #endif /* LTTNG_REF_INTERNAL_H */