X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fthreads.c;fp=citadel%2Fthreads.c;h=bea9665c3c5eba17ec14aa8af7fd6e16f59c431d;hp=4a4fe5163ec2260335ca7e537e1a39ea7cf2f601;hb=f2f392abe416b03750cb053fd0780f62c85d3ae4;hpb=5ce143deec653885c56c978b03acea9265477297 diff --git a/citadel/threads.c b/citadel/threads.c index 4a4fe5163..bea9665c3 100644 --- a/citadel/threads.c +++ b/citadel/threads.c @@ -63,6 +63,7 @@ pthread_mutex_t Critters[MAX_SEMAPHORES]; /* Things needing locking */ struct thread_tsd masterTSD; int server_shutting_down = 0; /* set to nonzero during shutdown */ +pthread_mutex_t ThreadCountMutex;; void InitializeSemaphores(void) @@ -191,6 +192,8 @@ void go_threading(void) abort(); } + pthread_mutex_init(&ThreadCountMutex, NULL); + /* Second call to module init functions now that threading is up */ initialise_modules(1); @@ -198,10 +201,10 @@ void go_threading(void) CtdlThreadCreate(worker_thread); /* The supervisor thread monitors worker threads and spawns more of them if it finds that - * they are all in use. FIXME make the 256 max threads a configurable value. + * they are all in use. */ while (!server_shutting_down) { - if ((active_workers == num_workers) && (num_workers < 256)) { + if ((active_workers == num_workers) && (num_workers < config.c_max_workers)) { CtdlThreadCreate(worker_thread); } usleep(1000000);