--- a/src/server/util/thrpool.h Tue Mar 19 17:38:32 2013 +0100 +++ b/src/server/util/thrpool.h Mon May 06 13:44:27 2013 +0200 @@ -29,6 +29,7 @@ #ifndef THREADPOOL_H #define THREADPOOL_H +#include "../public/nsapi.h" #include <pthread.h> #ifdef __cplusplus @@ -36,34 +37,24 @@ #endif typedef struct _pool_queue pool_queue_t; -typedef struct _thread_pool { +struct _thread_pool { pthread_mutex_t queue_lock; pthread_mutex_t avlbl_lock; pthread_cond_t available; + pool_queue_t *queue; int queue_len; - pool_queue_t *queue; -} threadpool_t; +}; -typedef void*(*job_callback_f)(void *data); -typedef struct _threadpool_job { +struct _threadpool_job { job_callback_f callback; void *data; -} threadpool_job; +}; struct _pool_queue { threadpool_job *job; pool_queue_t *next; }; - -threadpool_t* threadpool_new(int n); - -void* threadpool_func(void *data); - -threadpool_job* threadpool_get_job(threadpool_t *pool); - -void threadpool_run(threadpool_t *pool, job_callback_f func, void *data); - #ifdef __cplusplus } #endif