X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmain.c;h=a1b7161f90f9ecf84a8aaca37b88ba9f27592414;hb=b46d9426eba4685b2c84fb82b1521aafd3488da2;hp=60b7ec6ac4b37fb9e1f5f08f95ea29a0c02b176b;hpb=55831bf424312a6908ca07a904f288fba0919a9a;p=NeonServV5.git diff --git a/src/main.c b/src/main.c index 60b7ec6..a1b7161 100644 --- a/src/main.c +++ b/src/main.c @@ -42,6 +42,9 @@ static int running, hard_restart; static int statistics_requested_lusers = 0; int statistics_enabled; TIMEQ_CALLBACK(main_statistics); +#ifdef HAVE_THREADS +int running_threads; +#endif void cleanup() { free_sockets(); @@ -106,6 +109,7 @@ void * thread_main(void *arg) { destroyEvents(); queue_loop(); } + running_threads--; return NULL; } #endif @@ -160,11 +164,13 @@ main: pthread_t tid[worker_threads]; int tid_id = 0; for(tid_id = 0; tid_id < worker_threads; tid_id++) { + running_threads++; pthread_create(&tid[tid_id], NULL, thread_main, NULL); } for(tid_id = 0; tid_id < worker_threads; tid_id++) { pthread_join(tid[tid_id], NULL); } + running_threads = 0; #else time_t socket_wait; while(running) {