From 8d166b2d4bacf70b3f96682c1e283353fe29d30c Mon Sep 17 00:00:00 2001 From: bel Date: Mon, 4 Jul 2016 21:52:11 +0200 Subject: [PATCH] Use eventfd instead of pthread_cond (step 5/?) --- src/civetweb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/civetweb.c b/src/civetweb.c index 4e7af798..c81db6ce 100644 --- a/src/civetweb.c +++ b/src/civetweb.c @@ -1591,6 +1591,7 @@ typedef struct tagTHREADNAME_INFO { #include +#ifdef ALTERNATIVE_QUEUE static int event_create(void) { @@ -1636,6 +1637,7 @@ event_destroy(int eventhdl) { close(eventhdl); } +#endif #endif @@ -3060,6 +3062,7 @@ pthread_cond_destroy(pthread_cond_t *cv) } +#ifdef ALTERNATIVE_QUEUE static int event_create(void) { @@ -3087,6 +3090,7 @@ event_destroy(int eventhdl) { CloseHandle((HANDLE)eventhdl); } +#endif #if defined(__MINGW32__) @@ -12658,11 +12662,11 @@ consume_socket(struct mg_context *ctx, struct socket *sp, int thread_index) /* Worker threads take accepted socket from the queue */ static int -consume_socket(struct mg_context *ctx, struct socket *sp, int index) +consume_socket(struct mg_context *ctx, struct socket *sp, int thread_index) { #define QUEUE_SIZE(ctx) ((int)(ARRAY_SIZE(ctx->queue))) - (void)index; + (void)thread_index; (void)pthread_mutex_lock(&ctx->thread_mutex); DEBUG_TRACE("%s", "going idle");