TCP Socket - C Language
|
00001 00012 #ifndef POOL_H_ 00013 #define POOL_H_ 00014 00015 #include <stdlib.h> 00016 #include <pthread.h> 00017 #include <signal.h> 00018 00020 typedef struct joblist{ 00022 void *(*start_routine)(void*); 00024 void * arg; 00026 struct joblist * next; 00027 } joblist; 00028 00030 typedef struct ThreadPool{ 00032 volatile sig_atomic_t quitflag; 00034 volatile sig_atomic_t shutdown; 00035 sigset_t * signalmask; 00036 int pool_size; 00037 int job_max; 00038 int job_size; 00039 joblist * firstjob; 00040 joblist * lastjob; 00041 pthread_t * tids; 00043 pthread_mutex_t lock; 00044 pthread_cond_t notempty; 00045 pthread_cond_t empty; 00046 } th_pool; 00047 00059 th_pool * poolInit(int dim, int job_max, sigset_t *set); 00060 00077 int poolDispatcher(th_pool *pool, void *(*start_routine)(void*), void *arg); 00078 00093 int poolDestroy(th_pool *pool); 00094 00095 #endif /* POOL_H_ */