From e071d4691e6b49cee431e16b3d7941cac23c9559 Mon Sep 17 00:00:00 2001 From: xtne6f Date: Tue, 14 Jun 2016 19:52:49 +0900 Subject: [PATCH] Fix unlocked broadcast Since the purpose of this broadcast is to notify stop_flag, locking is once needed. --- src/civetweb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/civetweb.c b/src/civetweb.c index 0aae38ff..c2c4197f 100644 --- a/src/civetweb.c +++ b/src/civetweb.c @@ -12686,10 +12686,10 @@ master_thread_run(void *thread_func_param) close_all_listening_sockets(ctx); /* Wakeup workers that are waiting for connections to handle. */ + (void)pthread_mutex_lock(&ctx->thread_mutex); pthread_cond_broadcast(&ctx->sq_full); /* Wait until all threads finish */ - (void)pthread_mutex_lock(&ctx->thread_mutex); while (ctx->running_worker_threads > 0) { (void)pthread_cond_wait(&ctx->thread_cond, &ctx->thread_mutex); }