Sat, 14 May 2022 12:51:05 +0200
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;