コード例 #1
0
static tb_bool_t tb_aiop_rtor_select_delo(tb_aiop_rtor_impl_t* rtor, tb_aioo_impl_t const* aioo)
{
    // check
    tb_aiop_rtor_select_impl_t* impl = (tb_aiop_rtor_select_impl_t*)rtor;
    tb_assert_and_check_return_val(impl && aioo && aioo->sock, tb_false);

    // the aiop
    tb_aiop_impl_t* aiop = rtor->aiop;
    tb_assert_and_check_return_val(aiop, tb_false);

    // fd
    tb_long_t fd = tb_sock2fd(aioo->sock);

    // enter
    tb_spinlock_enter(&impl->lock.pfds);

    // del fds
    FD_CLR(fd, &impl->rfdi);
    FD_CLR(fd, &impl->wfdi);

    // leave
    tb_spinlock_leave(&impl->lock.pfds);

    // del sock => aioo
    tb_spinlock_enter(&impl->lock.hash);
    if (impl->hash) tb_hash_map_remove(impl->hash, aioo->sock);
    tb_spinlock_leave(&impl->lock.hash);

    // spak it
    if (aiop->spak[0]) tb_socket_send(aiop->spak[0], (tb_byte_t const*)"p", 1);

    // ok
    return tb_true;
}
コード例 #2
0
ファイル: dictionary.c プロジェクト: razrLeLe/tbox
tb_void_t tb_object_dictionary_remove(tb_object_ref_t object, tb_char_t const* key)
{
    // check
    tb_object_dictionary_t* dictionary = tb_object_dictionary_cast(object);
    tb_assert_and_check_return(dictionary && dictionary->hash && key);

    // del
    return tb_hash_map_remove(dictionary->hash, key);
}
コード例 #3
0
tb_void_t tb_hash_set_remove(tb_hash_set_ref_t self, tb_cpointer_t data)
{
    tb_hash_map_remove((tb_hash_map_ref_t)self, data);
}