void timers_shutdown(void) { if (initialized > 1) { initialized--; return; } /* Stop all timers. */ if (timers->heap->len > 0) warning(0, "Timers shutting down with %ld active timers.", timers->heap->len); while (timers->heap->len > 0) gwtimer_stop(timers->heap->tab[0]); /* Kill timer thread */ timers->stopping = 1; gwthread_wakeup(timers->thread); gwthread_join(timers->thread); initialized = 0; /* Free resources */ heap_destroy(timers->heap); mutex_destroy(timers->mutex); gw_free(timers); }
void gwtimer_destroy(Timer *timer) { gw_assert(initialized); if (timer == NULL) return; gwtimer_stop(timer); gwlist_remove_producer(timer->output); wap_event_destroy(timer->event); gw_free(timer); }
static void stop_initiator_timer(Timer *timer) { debug("wap.wtp_init", 0, "stopping timer"); gw_assert(timer); gwtimer_stop(timer); }