| #include <pthread.h> | |
| #include "thpool.h" | |
| //#ifdef __cplusplus | |
| //extern "C" { | |
| //#endif | |
| #define CONDARRAYMAX 20 | |
| typedef struct | |
| { | |
| pthread_cond_t cond; | |
| pthread_mutex_t mutex; | |
| int state; | |
| int index; | |
| int use_state; | |
| }cond_used_state; | |
| typedef struct | |
| { | |
| int requestID; | |
| int32_t token; | |
| int cond_index; | |
| int waitTime; | |
| }request_cond; | |
| typedef struct | |
| { | |
| threadpool pool; | |
| cond_used_state *cond_array; | |
| }timerArgv; | |
| extern timerArgv * timerArgv_t; | |
| extern int taskWorking; | |
| extern pthread_mutex_t task_Mutex; | |
| extern pthread_cond_t task_Cond; | |
| int millli_sleep_with_restart(int millisecond); | |
| int micro_sleep_with_restart(int microseconds); | |
| cond_used_state* findUnusedCond(cond_used_state cond_array[],int arraLength); | |
| void startWaitResp(void *arg); | |
| int addTaskToTimerMan(int time,int32_t token,int request); | |
| int sendSignalToTimer(int32_t token); | |
| int initTimeManagement(int max_thread); | |
| //#ifdef __cplusplus | |
| //} | |
| //#endif | |