Support for process management (memory allocation, logging, etc.)
void sc_refcount_init(sc_refcount_t *rc, int package_id)
Initialize a reference counter to 1.
int sc_refcount_unref(sc_refcount_t *rc)
Decrease the reference counter and notify when it reaches zero.
void sc_refcount_init_invalid(sc_refcount_t *rc)
Initialize a well-defined but unusable reference counter.
int sc_refcount_is_active(const sc_refcount_t *rc)
Check whether a reference counter has a positive value.
struct sc_refcount sc_refcount_t
The refcount structure is declared in public so its size is known.
void sc_refcount_ref(sc_refcount_t *rc)
Increase a reference counter.
sc_refcount_t * sc_refcount_new(int package_id)
Create a new reference counter with count initialized to 1.
int sc_refcount_is_last(const sc_refcount_t *rc)
Check whether a reference counter has value one.
void sc_refcount_destroy(sc_refcount_t *rc)
Destroy a reference counter.
The refcount structure is declared in public so its size is known.
Definition: sc_refcount.h:43
int refcount
The reference count is always positive for a valid counter.
Definition: sc_refcount.h:48
int package_id
The sc package that uses this reference counter.
Definition: sc_refcount.h:45