ui/common/threadpool.h

changeset 949
ef8f13c8c08f
parent 404
384f6d1f5784
child 950
39641cf150eb
equal deleted inserted replaced
948:94bc57d63128 949:ef8f13c8c08f
60 pool_queue_t *queue; 60 pool_queue_t *queue;
61 uint32_t queue_len; 61 uint32_t queue_len;
62 uint32_t num_idle; 62 uint32_t num_idle;
63 int min_threads; 63 int min_threads;
64 int max_threads; 64 int max_threads;
65 pthread_t *threads;
66 int nthreads;
65 }; 67 };
66 68
67 struct _threadpool_job { 69 struct _threadpool_job {
68 job_callback_f callback; 70 job_callback_f callback;
69 void *data; 71 void *data;
74 pool_queue_t *next; 76 pool_queue_t *next;
75 }; 77 };
76 78
77 UiThreadpool* threadpool_new(int min, int max); 79 UiThreadpool* threadpool_new(int min, int max);
78 int threadpool_start(UiThreadpool *pool); 80 int threadpool_start(UiThreadpool *pool);
81 int threadpool_join(UiThreadpool *pool);
79 void* threadpool_func(void *data); 82 void* threadpool_func(void *data);
80 threadpool_job* threadpool_get_job(UiThreadpool *pool); 83 threadpool_job* threadpool_get_job(UiThreadpool *pool);
81 void threadpool_run(UiThreadpool *pool, job_callback_f func, void *data); 84 void threadpool_run(UiThreadpool *pool, job_callback_f func, void *data);
82 void threadpool_enqueue_job(UiThreadpool *pool, threadpool_job *job); 85 void threadpool_enqueue_job(UiThreadpool *pool, threadpool_job *job);
83 86

mercurial