@cryptotaxi247 / netdata-1 / commits / f1eb5d445

prevent cancelling the sending thread with locks in place

Costa Tsaousis (ktsaou) committed Mar 1, 2017 at 02:49 UTC f1eb5d44506899924e46047957abf91c217146a9
1 file changed +6
src/rrdpush.c
+6
@@ -442,12 +442,18 @@ void *rrdpush_sender_thread(void *ptr) {
442 cleanup:
443 debug(D_WEB_CLIENT, "STREAM %s [send]: sending thread exits.", host->hostname);
444
445 + if(pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL) != 0)
446 + error("STREAM %s [send]: cannot set pthread cancel state to DISABLE.", host->hostname);
447 +
448 rrdpush_lock(host);
449 rrdhost_wrlock(host);
450 rrdpush_sender_thread_cleanup_locked_all(host);
451 rrdhost_unlock(host);
452 rrdpush_unlock(host);
453
454 + if(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0)
455 + error("STREAM %s [send]: cannot set pthread cancel state to ENABLE.", host->hostname);
456 +
457 pthread_exit(NULL);
458 return NULL;
459 }