src/lib/watchdog.c
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;
}
/*
 * Terminate the watchdog thread
 *
 * Returns: 0 on success
 *          errno on failure
 */
Terminate the watchdog thread
Returns: 0 on success
errno on failure
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;                       
   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;
}
int stop_watchdog ( void ) { int stat ; watchdog_t * p ; if ( ! wd_is_init ) { return 0 ; } quit = true ; 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 ; }
Terminate the watchdog thread
 Returns: 0 on success
          errno on failure
Terminate the watchdog thread Returns : 0 on success errno on failure
/* notify watchdog thread to stop */