From f5b97219d7e44569612a17e7b257f97b8f723d72 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 16 Mar 2020 17:47:02 +0100 Subject: lib: Fix thread management in thread pool manager The thread pool manager wasn't counting working threads when deciding to create new ones, resulting in constant starting of new threads when threads were busy. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/tpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/tpm.c') diff --git a/src/lib/tpm.c b/src/lib/tpm.c index 0ba9619b..ff0a22df 100644 --- a/src/lib/tpm.c +++ b/src/lib/tpm.c @@ -159,7 +159,7 @@ static void * tpmgr(void * o) if (pthread_cond_timedwait(&tpm->cond, &tpm->lock, &dl) == ETIMEDOUT) - if (tpm->cur > tpm->min) + if (tpm->cur - tpm->wrk > tpm->min) tpm_kill(tpm); pthread_mutex_unlock(&tpm->lock); -- cgit v1.2.3