From: Costa Tsaousis (ktsaou) Date: Wed, 1 Mar 2017 00:49:10 +0000 (+0200) Subject: prevent cancelling the sending thread with locks in place X-Git-Tag: ab-debian_0.20170311.01-0ab1~1^2~16^2~3 X-Git-Url: https://arthur.barton.de/gitweb/?p=netdata.git;a=commitdiff_plain;h=f1eb5d44506899924e46047957abf91c217146a9 prevent cancelling the sending thread with locks in place --- diff --git a/src/rrdpush.c b/src/rrdpush.c index 07fcfead..2dcbe9f5 100644 --- a/src/rrdpush.c +++ b/src/rrdpush.c @@ -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; }