From fbb296990918ebb15d36778f5ffcd4b870b7c451 Mon Sep 17 00:00:00 2001 From: Dave West Date: Mon, 2 Nov 2009 14:01:47 +0000 Subject: [PATCH] Allow simulation mode to be terminated before completion --- citadel/threads.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/citadel/threads.c b/citadel/threads.c index aa6636e0a..5f4de7bbd 100644 --- a/citadel/threads.c +++ b/citadel/threads.c @@ -1238,6 +1238,7 @@ void *simulation_worker (void*arg) { struct CitContext *this; this = CreateNewContext(); + CtdlThreadSleep(1); this->kill_me = 1; this->state = CON_IDLE; dead_session_purge(1); @@ -1252,7 +1253,7 @@ void *simulation_thread (void *arg) { long stats = statcount; - while(stats) { + while(stats && !CtdlThreadCheckStop()) { CtdlThreadCreate("Connection simulation worker", CTDLTHREAD_BIGSTACK, simulation_worker, NULL); stats--; } @@ -1390,7 +1391,7 @@ void go_threading(void) #ifdef THREADS_USESIGNALS if (CtdlThreadGetCount() && CT->state > CTDL_THREAD_STOP_REQ) #else - if (CtdlThreadGetCount() && !statcount) + if (CtdlThreadGetCount()) #endif CtdlThreadSleep(1); } -- 2.30.2