added thread count to cmd_netinfo
[NeonServV5.git] / src / main.c
index 60b7ec6ac4b37fb9e1f5f08f95ea29a0c02b176b..a1b7161f90f9ecf84a8aaca37b88ba9f27592414 100644 (file)
@@ -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) {