| 141 |
Kevin |
1 |
/* Create a new thread pool with n threads. */
|
|
|
2 |
struct thread_pool * thread_pool_new(int nthreads);
|
|
|
3 |
|
|
|
4 |
/* Shutdown this thread pool. May or may not execute already queued tasks. */
|
|
|
5 |
void thread_pool_shutdown(struct thread_pool *);
|
|
|
6 |
|
|
|
7 |
/* A function pointer representing a 'callable' */
|
|
|
8 |
typedef void (* thread_pool_callable_func_t) (void * data);
|
|
|
9 |
|
|
|
10 |
/* Submit a callable to thread pool and return future.
|
|
|
11 |
* The returned future can be used in future_get() and future_free()
|
|
|
12 |
*/
|
|
|
13 |
void thread_pool_submit(
|
|
|
14 |
struct thread_pool *,
|
|
|
15 |
thread_pool_callable_func_t callable,
|
|
|
16 |
void * callable_data);
|