]> arthur.barton.de Git - netdata.git/commitdiff
prevent cancelling the sending thread with locks in place
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Wed, 1 Mar 2017 00:49:10 +0000 (02:49 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Wed, 1 Mar 2017 00:49:10 +0000 (02:49 +0200)
src/rrdpush.c

index 07fcfead54001561c010491f83f46cb4e2cf555d..2dcbe9f57f3af64f8276f5a1b2857a2ca177f1ae 100644 (file)
@@ -442,12 +442,18 @@ void *rrdpush_sender_thread(void *ptr) {
 cleanup:
     debug(D_WEB_CLIENT, "STREAM %s [send]: sending thread exits.", host->hostname);
 
+    if(pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL) != 0)
+        error("STREAM %s [send]: cannot set pthread cancel state to DISABLE.", host->hostname);
+
     rrdpush_lock(host);
     rrdhost_wrlock(host);
     rrdpush_sender_thread_cleanup_locked_all(host);
     rrdhost_unlock(host);
     rrdpush_unlock(host);
 
+    if(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0)
+        error("STREAM %s [send]: cannot set pthread cancel state to ENABLE.", host->hostname);
+    
     pthread_exit(NULL);
     return NULL;
 }