Exemplo n.º 1
0
void elem::destroy()
{
    // Call destroy_fn and deallocate_fn on all but the leftmost value
    if (val != key)
    {
	cilk_c_monoid *monoid = &(hb->__c_monoid);
        cilk_c_reducer_destroy_fn_t    destroy_fn    = monoid->destroy_fn;
        cilk_c_reducer_deallocate_fn_t deallocate_fn = monoid->deallocate_fn;
	
        destroy_fn((void*)hb, val);
        deallocate_fn((void*)hb, val);
    }
    val = 0;
}
Exemplo n.º 2
0
void elem::destroy()
{
    if (! is_leftmost()) {

        // Call destroy_fn and deallocate_fn on the view, but not if it's the
        // leftmost view.
        cilk_c_monoid *monoid = &(hb->__c_monoid);
        cilk_c_reducer_destroy_fn_t    destroy_fn    = monoid->destroy_fn;
        cilk_c_reducer_deallocate_fn_t deallocate_fn = monoid->deallocate_fn;
	
        destroy_fn((void*)hb, view);
        deallocate_fn((void*)hb, view);
    }

    view = 0;
}
Exemplo n.º 3
0
Arquivo: list.c Projeto: PopeLevi/god
void list_destroy(list_t* list, void (*destroy_fn)(void*))
{
    list_t* next;
    list = list->first;

    /* Avoid doing this test inside the loop */
    /* to sustain speed */
    if (destroy_fn != NULL)
    {
	do
	{
	    next = list->next;
	    destroy_fn(list->data);
	    free(list);
	} while ((list = next) != NULL);
    } else {
	do
	{
	    next = list->next;
	    free(list);
	} while ((list = next) != NULL);
    }
}
Exemplo n.º 4
0
static void
mainloop_gio_destroy(gpointer c)
{
    mainloop_io_t *client = c;
    char *c_name = strdup(client->name);

    /* client->source is valid but about to be destroyed (ref_count == 0) in gmain.c
     * client->channel will still have ref_count > 0... should be == 1
     */
    crm_trace("Destroying client %s[%p]", c_name, c);

    if (client->ipc) {
        crm_ipc_close(client->ipc);
    }

    if (client->destroy_fn) {
        void (*destroy_fn) (gpointer userdata) = client->destroy_fn;

        client->destroy_fn = NULL;
        destroy_fn(client->userdata);
    }

    if (client->ipc) {
        crm_ipc_t *ipc = client->ipc;

        client->ipc = NULL;
        crm_ipc_destroy(ipc);
    }

    crm_trace("Destroyed client %s[%p]", c_name, c);

    free(client->name); client->name = NULL;
    free(client);

    free(c_name);
}