]> git.sur5r.net Git - bacula/bacula/commitdiff
Skip HB kill in FD if HB thread terminated
authorKern Sibbald <kern@sibbald.com>
Wed, 23 Jun 2010 06:26:29 +0000 (08:26 +0200)
committerKern Sibbald <kern@sibbald.com>
Wed, 23 Jun 2010 06:27:26 +0000 (08:27 +0200)
bacula/src/filed/heartbeat.c

index d50eec17ea86201148c60c4e7ba297c0fa325b4d..7141931201d51848eb1622331f97c197921d0f25 100644 (file)
@@ -139,9 +139,11 @@ void stop_heartbeat_monitor(JCR *jcr)
       jcr->hb_dir_bsock->set_timed_out();     /* set timed_out to terminate read */
       jcr->hb_dir_bsock->set_terminated();    /* set to terminate read */
    }
-   Dmsg0(100, "Send kill to heartbeat id\n");
-   pthread_kill(jcr->heartbeat_id, TIMEOUT_SIGNAL);  /* make heartbeat thread go away */
-   bmicrosleep(0, 50000);
+   if (jcr->hb_started) {
+      Dmsg0(100, "Send kill to heartbeat id\n");
+      pthread_kill(jcr->heartbeat_id, TIMEOUT_SIGNAL);  /* make heartbeat thread go away */
+      bmicrosleep(0, 50000);
+   }
    cnt = 0;
    /* Wait max 100 secs for heartbeat thread to stop */
    while (jcr->hb_started && cnt++ < 200) {