start threadpool in threadpool_run() if no threads are created yet webdav

Sat, 14 May 2022 12:51:05 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 14 May 2022 12:51:05 +0200
branch
webdav
changeset 358
f3b490a2150c
parent 357
f45e962edf45
child 359
79b28ae7bfbd

start threadpool in threadpool_run() if no threads are created yet

src/server/util/thrpool.c file | annotate | diff | comparison | revisions
--- a/src/server/util/thrpool.c	Sat May 14 12:45:59 2022 +0200
+++ b/src/server/util/thrpool.c	Sat May 14 12:51:05 2022 +0200
@@ -106,6 +106,12 @@
 }
 
 void threadpool_run(threadpool_t *pool, job_callback_f func, void *data) {
+    // TODO: handle errors
+    
+    if(pool->num_threads == 0) {
+        threadpool_start(pool);
+    }
+    
     threadpool_job *job = malloc(sizeof(threadpool_job));
     job->callback = func;
     job->data = data;

mercurial