Commit 1dab6fa0 authored by Geoff Simmons's avatar Geoff Simmons

varnishevent bugfix: don't cancel the monitor thread if it's not running

parent 24472cf7
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "libvarnish.h" #include "libvarnish.h"
#include "vas.h" #include "vas.h"
static int run; static int run = 0;
static pthread_t monitor; static pthread_t monitor;
static pthread_mutex_t stats_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t stats_lock = PTHREAD_MUTEX_INITIALIZER;
...@@ -94,9 +94,11 @@ MON_Output(void) ...@@ -94,9 +94,11 @@ MON_Output(void)
void void
MON_Shutdown(void) MON_Shutdown(void)
{ {
run = 0; if (run) {
AZ(pthread_cancel(monitor)); run = 0;
AZ(pthread_join(monitor, NULL)); AZ(pthread_cancel(monitor));
AZ(pthread_join(monitor, NULL));
}
AZ(pthread_mutex_destroy(&stats_lock)); AZ(pthread_mutex_destroy(&stats_lock));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment