* thread pool, it remembers running requests and gathers replies. A single work queue
* should not be used by multiple threads simultaneously.
*
* thread pool, it remembers running requests and gathers replies. A single work queue
* should not be used by multiple threads simultaneously.
*
* When a thread pool is initialized, new_thread() is called for every thread first,
* allocating struct worker_thread (and user-defined thread context following it) for
* each thread. Then the threads are fired and each of them executes the init_thread()
* When a thread pool is initialized, new_thread() is called for every thread first,
* allocating struct worker_thread (and user-defined thread context following it) for
* each thread. Then the threads are fired and each of them executes the init_thread()
struct worker_thread *(*new_thread)(void); // default: xmalloc the struct
void (*free_thread)(struct worker_thread *t); // default: xfree
void (*init_thread)(struct worker_thread *t); // default: empty
struct worker_thread *(*new_thread)(void); // default: xmalloc the struct
void (*free_thread)(struct worker_thread *t); // default: xfree
void (*init_thread)(struct worker_thread *t); // default: empty
struct work_queue *reply_to; // Where to queue the request when it's finished
void (*go)(struct worker_thread *t, struct work *w); // Called inside the worker thread
struct work_queue *reply_to; // Where to queue the request when it's finished
void (*go)(struct worker_thread *t, struct work *w); // Called inside the worker thread