3 void refcount_ini(Refcount *refcount, void *obj, SingleCallback del)
8 pthread_mutex_init(&refcount->mtx, NULL);
11 void refcount_dst(Refcount *refcount)
13 pthread_mutex_destroy(&refcount->mtx);
16 void *refcount_inc(Refcount *refcount)
18 pthread_mutex_lock(&refcount->mtx);
20 pthread_mutex_unlock(&refcount->mtx);
24 void *refcount_grb(Refcount *refcount)
26 return refcount_obj(refcount_inc(refcount));
29 void refcount_drp(Refcount *refcount)
31 pthread_mutex_lock(&refcount->mtx);
32 unsigned short count = --refcount->cnt;
33 pthread_mutex_unlock(&refcount->mtx);
36 refcount->del(refcount->obj);
39 void *refcount_obj(Refcount *refcount)