Beispiel #1
0
void normalize_cache_destroy(normalize_cache_t nc)
{
    if (nc)
    {
        struct cached_item *ci = nc->items;
        for (; ci; ci = ci->next)
            normalize_record_destroy(ci->nt);
        yaz_mutex_destroy(&nc->mutex);
        nmem_destroy(nc->nmem);
    }
}
Beispiel #2
0
void http_sessions_destroy(http_sessions_t hs)
{
    if (hs)
    {
        struct http_session *s = hs->session_list;
        while (s)
        {
            struct http_session *s_next = s->next;
            iochan_destroy(s->timeout_iochan);
            session_destroy(s->psession);
            nmem_destroy(s->nmem);
            s = s_next;
        }
        yaz_mutex_destroy(&hs->mutex);
        xfree(hs);
    }
}
Beispiel #3
0
void iochan_man_destroy(iochan_man_t *mp) {
    if (*mp) {
        IOCHAN c;
        if ((*mp)->sel_thread)
            sel_thread_destroy((*mp)->sel_thread);

        yaz_mutex_enter((*mp)->iochan_mutex);
        c = (*mp)->channel_list;
        (*mp)->channel_list = NULL;
        yaz_mutex_leave((*mp)->iochan_mutex);
        while (c) {
            c = iochan_destroy_real(c);
        }
        yaz_mutex_destroy(&(*mp)->iochan_mutex);
        xfree(*mp);
        *mp = 0;
    }
}
Beispiel #4
0
void http_server_destroy(http_server_t hs)
{
    if (hs)
    {
        int r;

        yaz_mutex_enter(hs->mutex); /* OK: hs->mutex may be NULL */
        r = --(hs->ref_count);
        yaz_mutex_leave(hs->mutex);

        if (r == 0)
        {
            http_sessions_destroy(hs->http_sessions);
            xfree(hs->proxy_addr);
            yaz_mutex_destroy(&hs->mutex);
            if (hs->record_file)
                fclose(hs->record_file);
            xfree(hs);
        }
    }
}
Beispiel #5
0
void sel_thread_destroy(sel_thread_t p)
{
    int i;
    yaz_mutex_enter(p->mutex);
    p->stop_flag = 1;
    yaz_cond_broadcast(p->input_data);
    yaz_mutex_leave(p->mutex);
    
    for (i = 0; i< p->no_threads; i++)
        yaz_thread_join(&p->thread_id[i], 0);

    if (p->work_destroy)
    {
        queue_trav(p->input_queue, p->work_destroy);
        queue_trav(p->output_queue, p->work_destroy);
    }

    yaz_spipe_destroy(p->spipe);
    yaz_cond_destroy(&p->input_data);
    yaz_mutex_destroy(&p->mutex);
    nmem_destroy(p->nmem);
}