src/server/util/thrpool.h

changeset 67
50505dc3f8a6
parent 59
ab25c0a231d0
equal deleted inserted replaced
66:74babc0082b7 67:50505dc3f8a6
40 struct _thread_pool { 40 struct _thread_pool {
41 pthread_mutex_t queue_lock; 41 pthread_mutex_t queue_lock;
42 pthread_mutex_t avlbl_lock; 42 pthread_mutex_t avlbl_lock;
43 pthread_cond_t available; 43 pthread_cond_t available;
44 pool_queue_t *queue; 44 pool_queue_t *queue;
45 int queue_len; 45 uint32_t queue_len;
46 uint32_t num_idle;
47 uint32_t num_threads;
48 int min_threads;
49 int max_threads;
46 }; 50 };
47 51
48 struct _threadpool_job { 52 struct _threadpool_job {
49 job_callback_f callback; 53 job_callback_f callback;
50 void *data; 54 void *data;
53 struct _pool_queue { 57 struct _pool_queue {
54 threadpool_job *job; 58 threadpool_job *job;
55 pool_queue_t *next; 59 pool_queue_t *next;
56 }; 60 };
57 61
62 void threadpool_enqueue_job(threadpool_t *pool, threadpool_job *job);
63
58 #ifdef __cplusplus 64 #ifdef __cplusplus
59 } 65 }
60 #endif 66 #endif
61 67
62 #endif /* THREADPOOL_H */ 68 #endif /* THREADPOOL_H */

mercurial