static tb_void_t tb_object_dictionary_clear(tb_object_ref_t object) { tb_object_dictionary_t* dictionary = tb_object_dictionary_cast(object); tb_assert_and_check_return(dictionary); // clear if (dictionary->hash) tb_hash_map_clear(dictionary->hash); }
tb_void_t tb_hash_map_exit(tb_hash_map_ref_t hash_map) { // check tb_hash_map_impl_t* impl = (tb_hash_map_impl_t*)hash_map; tb_assert_and_check_return(impl); // clear it tb_hash_map_clear(hash_map); // free impl list if (impl->hash_list) tb_free(impl->hash_list); // free it tb_free(impl); }
static tb_void_t tb_aiop_rtor_select_cler(tb_aiop_rtor_impl_t* rtor) { tb_aiop_rtor_select_impl_t* impl = (tb_aiop_rtor_select_impl_t*)rtor; if (impl) { // free fds tb_spinlock_enter(&impl->lock.pfds); impl->sfdm = 0; FD_ZERO(&impl->rfdi); FD_ZERO(&impl->wfdi); FD_ZERO(&impl->rfdo); FD_ZERO(&impl->wfdo); tb_spinlock_leave(&impl->lock.pfds); // clear hash tb_spinlock_enter(&impl->lock.hash); if (impl->hash) tb_hash_map_clear(impl->hash); tb_spinlock_leave(&impl->lock.hash); // spak it if (rtor->aiop && rtor->aiop->spak[0]) tb_socket_send(rtor->aiop->spak[0], (tb_byte_t const*)"p", 1); } }
tb_void_t tb_hash_set_clear(tb_hash_set_ref_t self) { tb_hash_map_clear((tb_hash_map_ref_t)self); }