Example #1
0
void wtty_destroy(wtty_t * w)
{
    //wtty_stop(w); // not really good idea
    // Check unstopped
    if( w->started ) SHOW_ERROR0( 0, "unstopped" );
    hal_mutex_destroy( &w->mutex );
    hal_cond_destroy( &w->rcond );
    hal_cond_destroy( &w->wcond );
#if CONF_WTTY_SIZE
    free(w->buf);
#endif
    free(w);
}
static errno_t cache_do_destroy( cache_t *c )
{

    hal_mutex_lock( &c->lock );
    while(!queue_empty(&c->lru))
    {
        cache_el_t * el;
        //queue_remove_last( &c->lru, el, cache_el_t *, lru );
        queue_remove_first( &c->lru, el, cache_el_t *, lru );
        cache_do_destroy_el(el);

    }
    hal_mutex_unlock( &c->lock );

    hash_uninit(c->hash);
    hal_mutex_destroy( &c->lock );
    return 0;
}