X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=src%2Fweb_server.c;h=39e5ef0ed186487a6517613213cbee44ed4ce71b;hb=78c8a6bad687723c43930be4307b051af3977c22;hp=b0e26283384f85e6a80480494273989dbab41496;hpb=9e48033fbcf2f83c8359b181fbe4cf6dab757616;p=netdata.git diff --git a/src/web_server.c b/src/web_server.c index b0e26283..39e5ef0e 100644 --- a/src/web_server.c +++ b/src/web_server.c @@ -390,7 +390,7 @@ static inline void cleanup_web_clients(void) { #define CLEANUP_EVERY_EVENTS 100 void *socket_listen_main_multi_threaded(void *ptr) { - (void)ptr; + struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr; web_server_mode = WEB_SERVER_MODE_MULTI_THREADED; info("Multi-threaded WEB SERVER thread created with task id %d", gettid()); @@ -470,6 +470,9 @@ void *socket_listen_main_multi_threaded(void *ptr) { debug(D_WEB_CLIENT, "LISTENER: exit!"); close_listen_sockets(); + static_thread->enabled = 0; + static_thread->thread = NULL; + pthread_exit(NULL); return NULL; } @@ -518,7 +521,7 @@ static inline int single_threaded_unlink_client(struct web_client *w, fd_set *if } void *socket_listen_main_single_threaded(void *ptr) { - (void)ptr; + struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr; web_server_mode = WEB_SERVER_MODE_SINGLE_THREADED; @@ -637,5 +640,9 @@ void *socket_listen_main_single_threaded(void *ptr) { debug(D_WEB_CLIENT, "LISTENER: exit!"); close_listen_sockets(); + + static_thread->enabled = 0; + static_thread->thread = NULL; + pthread_exit(NULL); return NULL; }