threadpool.h (398B)
1 #pragma once 2 3 // https://nachtimwald.com/2019/04/12/thread-pool-in-c/ 4 #include "types.h" 5 #include <stdlib.h> 6 7 typedef void (*ThreadFunc)(void *arg); 8 9 typedef struct ThreadPool ThreadPool; 10 11 ThreadPool *ThreadPool_make(unsigned int thread_count); 12 void ThreadPool_free(ThreadPool *pool); 13 14 void ThreadPool_addWork(ThreadPool *pool, ThreadFunc func, void *arg); 15 void ThreadPool_wait(ThreadPool *pool); 16