Modernized version of the thread pool used in a internship project in 2015
- why thread pool?
- the original project was for running a hospital signup server on an embedded system. It has limited resources. A number of the maximum concurrent thread must be set.
- In the meantime, having a few thread stand-by for incoming jobs saves the overhead creating new threads for every connection .
threadpool.c
threadpool.h
thread_pool_t *pool = thread_pool_create(4, 100, 0);
thread_pool_submit(pool, compute, (void *)(i));
// ...
thread_pool_destroy(pool);
Used to be a TCP server talking in json to destop Qt clients. I am extending it into a http server.