Commit 7f365177 authored by Jakob Bornecrantz's avatar Jakob Bornecrantz
Browse files

xrt: Add xrt_reference struct

parent 6774a7e1
......@@ -16,6 +16,16 @@ extern "C" {
#endif
/*!
* A base class for reference counted objects.
*
* @ingroup xrt_iface
*/
struct xrt_reference
{
uint32_t count;
};
/*!
* Which blend mode does the device support, used as both a bitfield and value.
*
......@@ -356,6 +366,26 @@ union xrt_output_value {
};
/*
*
* Inline functions
*
*/
static inline bool
xrt_reference_dec(struct xrt_reference *xref)
{
int count = xrt_atomic_dec_return(&xref->count);
return count == 0;
}
static inline void
xrt_reference_inc(struct xrt_reference *xref)
{
xrt_atomic_inc_return(&xref->count);
}
#ifdef __cplusplus
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment