-#ifndef LTTNG_REF_INTERNAL_H
-#define LTTNG_REF_INTERNAL_H
-
/*
* LTTng - Non thread-safe reference counting
*
*
*/
+#ifndef LTTNG_REF_INTERNAL_H
+#define LTTNG_REF_INTERNAL_H
+
+#include <common/macros.hpp>
+
+#include <urcu/urcu.h>
-typedef void (*lttng_release_func)(void *);
+using lttng_release_func = void (*)(void *);
struct lttng_ref {
unsigned long count;
lttng_release_func release;
};
-static inline
-void lttng_ref_init(struct lttng_ref *ref, lttng_release_func release)
+static inline void lttng_ref_init(struct lttng_ref *ref, lttng_release_func release)
{
LTTNG_ASSERT(ref);
ref->count = 1;
ref->release = release;
}
-static inline
-void lttng_ref_get(struct lttng_ref *ref)
+static inline void lttng_ref_get(struct lttng_ref *ref)
{
LTTNG_ASSERT(ref);
ref->count++;
LTTNG_ASSERT(ref->count);
}
-static inline
-void lttng_ref_put(struct lttng_ref *ref)
+static inline void lttng_ref_put(struct lttng_ref *ref)
{
LTTNG_ASSERT(ref);
/* Underflow check. */