sig_ht is NOT internally synchronized. The refcount (sig_ht_ref /
sig_ht_destroy) only arbitrates which caller is responsible for
tearing the table down when it's shared by pointer; it does not
make concurrent sig_ht_add/update/get/remove/walk calls from
multiple threads safe. A table 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 hashtable.
sig_ht_ref
void sig_ht_ref(sig_ht * ht)
Parameter
Type
ht
sig_ht *
Adds a reference to the hashtable's refcount (sig_refcount_h). Each
call to sig_ht_ref() must be matched by an additional call to
sig_ht_destroy() before the hashtable is actually freed.
sig_ht_destroy
void sig_ht_destroy(sig_ht * ht)
Parameter
Type
ht
sig_ht *
Releases a reference to the hashtable. sig_ht_create() starts the
refcount at 1, so a container that is never shared via sig_ht_ref()
is fully torn down (elements destroyed via dtor, buckets and the
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.