#ifndef THREADPOOL_H
#define THREADPOOL_H
#include "../public/nsapi.h"
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _pool_queue
pool_queue_t;
struct _thread_pool {
pthread_mutex_t queue_lock;
pthread_mutex_t avlbl_lock;
pthread_cond_t available;
pool_queue_t *queue;
uint32_t queue_len;
uint32_t num_idle;
uint32_t num_threads;
int min_threads;
int max_threads;
};
struct _threadpool_job {
job_callback_f callback;
void *data;
};
struct _pool_queue {
threadpool_job *job;
pool_queue_t *next;
};
void threadpool_enqueue_job(
threadpool_t *pool, threadpool_job *job);
#ifdef __cplusplus
}
#endif
#endif