Identical shape to sig_ht's sig_dtor_fn (legal to redefine a
typedef to the same type in C11) — sig_ll intentionally has no
header dependency on sig_ht; they are independent peer
collections.
sig_ll is NOT internally synchronized. The refcount (sig_ll_ref /
sig_ll_destroy) only arbitrates which caller is responsible for
tearing the list down when it's shared by pointer; it does not make
concurrent sig_ll_push/pop/unshift/shift/remove/walk calls from
multiple threads safe. A list touched from more than one thread
must be protected by a mutex (e.g. sig_mutex from sig_thread.h)
owned by the caller.
dtor may be NULL if stored values are not owned by the list. Applied
on sig_ll_remove() and sig_ll_destroy(), never on pop()/shift() —
those transfer ownership to the caller.
sig_ll_ref
void sig_ll_ref(sig_ll * ll)
Parameter
Type
ll
sig_ll *
Adds a reference to the list's refcount (sig_refcount_h). Each call
to sig_ll_ref() must be matched by an additional call to
sig_ll_destroy() before the list is actually freed.
sig_ll_destroy
void sig_ll_destroy(sig_ll * ll)
Parameter
Type
ll
sig_ll *
Releases a reference to the list. sig_ll_create() starts the
refcount at 1, so a container that is never shared via sig_ll_ref()
is fully torn down (elements destroyed via dtor, struct freed) on
the first call, exactly as before. If other references remain,
this call only decrements the count and returns without freeing or
destroying anything.