Initialize threadpoolInitializes a threadpool. This function will not return untill all threads have initialized successfully.
.. threadpool tpool; //First we declare a threadpool tpool = tpool_init(4); //then we initialize it to 4 threads ..
- Parameters
-
| num_threads | number of threads to be created in the threadpool |
- Returns
- threadpool created threadpool on success, NULL on error
#pragma once
#if (__OpenBSD__)
#include "pthread.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define tpoolLockCount 512
typedef struct {
union {
};
union {
char *s2;
};
union {
char **list;
int status;
};
void (*cb)(void*);
void *cbArgs;
void *channel;
#define tpoolAdd(task, args) tpool_add_work(tpool, task, args)
#define tpoolWait tpool_wait(tpool)
#define tpoolKill tpool_destroy(tpool)
#define tpoolPause tpool_pause(tpool)
#define tpoolResume tpool_resume(tpool)
#define tpoolNum tpool_num_threads_working(tpool)
int tpool_add_work(threadpool,
void (*function_p)(
void*),
void* arg_p);
#ifdef __cplusplus
}
#endif