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
15 typedef void (*lttng_release_func
)(void *);
19 lttng_release_func release
;
23 void lttng_ref_init(struct lttng_ref
*ref
, lttng_release_func release
)
27 ref
->release
= release
;
31 void lttng_ref_get(struct lttng_ref
*ref
)
40 void lttng_ref_put(struct lttng_ref
*ref
)
43 /* Underflow check. */
45 if (caa_unlikely((--ref
->count
) == 0)) {
50 #endif /* LTTNG_REF_INTERNAL_H */