]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/watchdog.c
Use the command line utility dropdb instead of the psql command
[bacula/bacula] / bacula / src / lib / watchdog.c
index 3d2413685c1c937f516e4e5b303c78a80ad7add5..bcba37e56552d162fa395910c1d9fe6dd6e7a972 100755 (executable)
@@ -45,12 +45,10 @@ static void *watchdog_thread(void *arg);
 /* Static globals */
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t  timer = PTHREAD_COND_INITIALIZER;
-static int quit;
+static bool quit;
 static bool wd_is_init = false;
 
 /* Forward referenced callback functions */
-static void callback_child_timer(watchdog_t *self);
-static void callback_thread_timer(watchdog_t *self);
 static pthread_t wd_tid;
 
 /* Static globals */
@@ -71,7 +69,7 @@ int start_watchdog(void)
 
    Dmsg0(200, "Initialising NicB-hacked watchdog thread\n");
    watchdog_time = time(NULL);
-   quit = FALSE;
+   quit = false;
    if ((stat = pthread_create(&wd_tid, NULL, watchdog_thread, NULL)) != 0) {
       return stat;
    }
@@ -91,7 +89,7 @@ int stop_watchdog(void)
    watchdog_t *p, *n;
 
    if (!wd_is_init) {
-      Emsg0(M_ABORT, 0, "BUG! stop_watchdog called before start_watchdog\n");
+      return 0;
    }
 
    Dmsg0(200, "Sending stop signal to NicB-hacked watchdog thread\n");
@@ -159,7 +157,7 @@ bool register_watchdog(watchdog_t *wd)
    wd->next_fire = watchdog_time + wd->interval;
    TAILQ_INSERT_TAIL(&wd_queue, wd, qe);
    Dmsg3(200, "Registered watchdog %p, interval %d%s\n",
-        wd, wd->interval, wd->one_shot ? " one shot" : "");
+         wd, wd->interval, wd->one_shot ? " one shot" : "");
    V(mutex);
 
    return false;
@@ -176,7 +174,7 @@ bool unregister_watchdog_unlocked(watchdog_t *wd)
    TAILQ_FOREACH_SAFE(p, &wd_queue, qe, n) {
       if (wd == p) {
         TAILQ_REMOVE(&wd_queue, wd, qe);
-        Dmsg1(200, "Unregistered watchdog %p\n", wd);
+         Dmsg1(200, "Unregistered watchdog %p\n", wd);
         return true;
       }
    }
@@ -184,7 +182,7 @@ bool unregister_watchdog_unlocked(watchdog_t *wd)
    TAILQ_FOREACH_SAFE(p, &wd_inactive, qe, n) {
       if (wd == p) {
         TAILQ_REMOVE(&wd_inactive, wd, qe);
-        Dmsg1(200, "Unregistered inactive watchdog %p\n", wd);
+         Dmsg1(200, "Unregistered inactive watchdog %p\n", wd);
         return true;
       }
    }
@@ -229,7 +227,7 @@ static void *watchdog_thread(void *arg)
            /* Run the callback */
            p->callback(p);
 
-           /* Reschedule (or move to inactive list if it's a one-shot timer) */
+            /* Reschedule (or move to inactive list if it's a one-shot timer) */
            if (p->one_shot) {
               TAILQ_REMOVE(&wd_queue, p, qe);
               TAILQ_INSERT_TAIL(&wd_inactive, p, qe);