Go to the source code of this file.
◆ alloc()
static ANN bool alloc |
( |
threadpool_t * | p, |
|
|
const uint32_t | thread_count, |
|
|
const uint32_t | queue_size ) |
|
static |
◆ ANN2()
Definition at line 66 of file threadpool.c.
66 {
68 return false;
69 const uint32_t next = (
pool->tail + 1) %
pool->queue_size;
75 return true;
76}
static ANN int gwt_signal(gwtcond_t *cond)
◆ free_threadpool()
Definition at line 85 of file threadpool.c.
85 {
91 for(uint32_t i = 0; i < p->
started; i++)
94 }
98 free(p);
99}
static ANN void gwt_cond_end(gwtcond_t *cond)
static ANN int gwt_broadcast(gwtcond_t *cond)
static ANN int gwt_unlock(gwtlock_t *lock)
static ANN void gwt_join(gwtthread_t thread)
static ANN void gwt_lock_end(gwtlock_t *lock)
static ANN int gwt_lock(gwtlock_t *lock)
◆ new_threadpool()
threadpool_t * new_threadpool |
( |
const uint32_t | thread_count, |
|
|
const uint32_t | queue_size ) |
Definition at line 101 of file threadpool.c.
101 {
103 if(!p) return NULL;
108 if(
alloc(p, thread_count, queue_size) || !
utils(p) ||
109 !
start(p, thread_count)) {
111 return NULL;
112 }
113 return p;
114}
static ANN bool start(threadpool_t *p, const uint32_t thread_count)
static ANN bool utils(threadpool_t *p)
static ANN bool alloc(threadpool_t *p, const uint32_t thread_count, const uint32_t queue_size)
ANN void free_threadpool(threadpool_t *p)
◆ start()
Definition at line 57 of file threadpool.c.
57 {
58 for(uint32_t i = 0; i < thread_count; i++) {
60 if(ret) return false;
62 }
63 return true;
64}
static ANN gwtreturn_t threadpool_thread(void *data)
static ANN bool gwt_create(gwtthread_t *thread, gwtreturn_t(*fun)(void *), void *arg)
◆ threadpool_add()
bool threadpool_add |
( |
threadpool_t * | p, |
|
|
void(* | routine )(void *), |
|
|
void * | arg ) |
◆ threadpool_thread()
Definition at line 23 of file threadpool.c.
23 {
25 while(true) {
34 task.routine(task.arg);
35 }
38}
#define THREAD_RETURN(arg)
static ANN void gwt_wait(gwtcond_t *cond, gwtlock_t *lock)
◆ utils()
Definition at line 46 of file threadpool.c.
46 {
47#ifdef BUILD_ON_WINDOWS
49#endif
54 return true;
55}
static ANN int gwt_cond_ini(gwtcond_t *cond)
static ANN int gwt_lock_ini(gwtlock_t *lock)