Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
struct future * thread_pool_submit(
14
        struct thread_pool *, 
15
        thread_pool_callable_func_t callable, 
16
        void * callable_data);
17
 
18
/* Make sure that thread pool has completed executing this callable,
19
 * then return result. */
20
void * future_get(struct future *);
21
 
22
/* Deallocate this future.  Must be called after future_get() */
23
void future_free(struct future *);