void apb_reference(FAR struct ap_buffer_s *apb) { /* Do we need any thread protection here? Almost certaily... */ apb_semtake(apb); apb->crefs++; apb_semgive(apb); }
void apb_free(FAR struct ap_buffer_s *apb) { int refcount; /* Perform a reference count decrement and possibly release the memory */ apb_semtake(apb); refcount = apb->crefs--; apb_semgive(apb); if (refcount == 1) { auddbg("Freeing %p\n", apb); kufree(apb); } }
void apb_free(FAR struct ap_buffer_s *apb) { int refcount; /* Perform a reference count decrement and possibly release the memory */ apb_semtake(apb); refcount = apb->crefs--; apb_semgive(apb); if (refcount <= 1) { audinfo("Freeing %p\n", apb); nxsem_destroy(&apb->sem); lib_ufree(apb); } }