| 1 |
|
| 2 |
|
| 3 |
#ifndef eslTHREADS_INCLUDED |
| 4 |
#define eslTHREADS_INCLUDED |
| 5 |
#include <esl_config.h> |
| 6 |
|
| 7 |
#include <pthread.h> |
| 8 |
|
| 9 |
typedef struct { |
| 10 |
int threadCount; |
| 11 |
pthread_t *threadId; |
| 12 |
void **data; |
| 13 |
|
| 14 |
int startThread; |
| 15 |
pthread_mutex_t startMutex; |
| 16 |
pthread_cond_t startCond; |
| 17 |
|
| 18 |
void (*func)(void *); |
| 19 |
} ESL_THREADS; |
| 20 |
|
| 21 |
|
| 22 |
extern ESL_THREADS *esl_threads_Create(void (*func)(void *)); |
| 23 |
extern void esl_threads_Destroy(ESL_THREADS *obj); |
| 24 |
|
| 25 |
extern int esl_threads_AddThread (ESL_THREADS *obj, void *data); |
| 26 |
extern int esl_threads_GetWorkerCount(ESL_THREADS *obj); |
| 27 |
extern int esl_threads_WaitForStart (ESL_THREADS *obj); |
| 28 |
extern int esl_threads_WaitForFinish (ESL_THREADS *obj); |
| 29 |
|
| 30 |
extern int esl_threads_Started (ESL_THREADS *obj, int *ret_workeridx); |
| 31 |
extern void *esl_threads_GetData (ESL_THREADS *obj, int workeridx); |
| 32 |
extern int esl_threads_Finished(ESL_THREADS *obj, int workeridx); |
| 33 |
|
| 34 |
extern int esl_threads_CPUCount(int *ret_ncpu); |
| 35 |
extern int esl_threads_GetCPUCount(void); |
| 36 |
|
| 37 |
#endif |