/* Releases tcp_helper_resource_t on the tcp_helper_cluster_t. If no * more tcp_helper_resource_t's, then frees it. * * This function will acquire the thc_mutex. */ void tcp_helper_cluster_release(tcp_helper_cluster_t* thc, tcp_helper_resource_t* thr) { mutex_lock(&thc_mutex); if( thr != NULL ) thc_remove_thr(thc, thr); if( oo_atomic_dec_and_test(&thc->thc_ref_count) ) thc_cluster_free(thc); mutex_unlock(&thc_mutex); }
static void citp_epoll_dtor(citp_fdinfo* fdi, int fdt_locked) { struct citp_epoll_fd* ep = fdi_to_epoll(fdi); if (!oo_atomic_dec_and_test(&ep->refcount)) return; CITP_FDTABLE_LOCK(); ci_tcp_helper_close_no_trampoline(ep->shared->epfd); __citp_fdtable_reserve(ep->shared->epfd, 0); munmap(ep->shared, sizeof(*ep->shared)); ci_tcp_helper_close_no_trampoline(ep->epfd_os); __citp_fdtable_reserve(ep->epfd_os, 0); CITP_FDTABLE_UNLOCK(); CI_FREE_OBJ(ep); }
void oo_iobufset_resource_release(struct oo_iobufset *iobrs, int reset_pending) { if (oo_atomic_dec_and_test(&iobrs->ref_count)) oo_iobufset_resource_free(iobrs, reset_pending); }
void oo_iobufset_pages_release(struct oo_buffer_pages *pages) { if (oo_atomic_dec_and_test(&pages->ref_count)) oo_iobufset_free_pages(pages); }