/* * Terminate the watchdog thread * * Returns: 0 on success * errno on failure */ int stop_watchdog(void) { int stat; watchdog_t *p; if (!wd_is_init) { return 0; } quit = true; /* notify watchdog thread to stop */ ping_watchdog(); stat = pthread_join(wd_tid, NULL); while (!wd_queue->empty()) { void *item = wd_queue->first(); wd_queue->remove(item); p = (watchdog_t *)item; if (p->destructor != NULL) { p->destructor(p); } free(p); } delete wd_queue; wd_queue = NULL; while (!wd_inactive->empty()) { void *item = wd_inactive->first(); wd_inactive->remove(item); p = (watchdog_t *)item; if (p->destructor != NULL) { p->destructor(p); } free(p); } delete wd_inactive; wd_inactive = NULL; rwl_destroy(&lock); wd_is_init = false; return stat; }
void term_vol_list_lock() { rwl_destroy(&vol_list_lock); }