summaryrefslogtreecommitdiff
path: root/src/threadpool.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/threadpool.c')
-rw-r--r--src/threadpool.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/threadpool.c b/src/threadpool.c
index 7a2f93a..8c6b243 100644
--- a/src/threadpool.c
+++ b/src/threadpool.c
@@ -76,7 +76,7 @@ typedef struct ctqueue {
76task * task_new(gcallback callback, fcallback freecb, void *data) { 76task * task_new(gcallback callback, fcallback freecb, void *data) {
77 if(callback == NULL) ERRRET(EINVAL, NULL); 77 if(callback == NULL) ERRRET(EINVAL, NULL);
78 78
79 task *tsk = calloc(1, sizeof(*tsk)); 79 task *tsk = VXGG_CALLOC(1, sizeof(*tsk));
80 if(!tsk) return NULL; 80 if(!tsk) return NULL;
81 81
82 tsk->callback = callback; 82 tsk->callback = callback;
@@ -129,7 +129,7 @@ int task_fired(task *tsk) {
129tqnode * tqnode_new(tqnode *next, tqnode *prev, task *tsk) { 129tqnode * tqnode_new(tqnode *next, tqnode *prev, task *tsk) {
130 if(!tsk) ERRRET(EINVAL, NULL); 130 if(!tsk) ERRRET(EINVAL, NULL);
131 131
132 tqnode *node = calloc(1, sizeof(*node)); 132 tqnode *node = VXGG_CALLOC(1, sizeof(*node));
133 if(!node) return NULL; 133 if(!node) return NULL;
134 134
135 node->next = next; 135 node->next = next;
@@ -166,7 +166,7 @@ void tqnode_free(void *tqn) {
166 * @retval (taskqueue*)[NULL, taskqueue*] Returns a new taskqueue object. Returns `null` and sets errno on error 166 * @retval (taskqueue*)[NULL, taskqueue*] Returns a new taskqueue object. Returns `null` and sets errno on error
167 */ 167 */
168taskqueue * taskqueue_new(void) { 168taskqueue * taskqueue_new(void) {
169 taskqueue *tq = calloc(1, sizeof(*tq)); 169 taskqueue *tq = VXGG_CALLOC(1, sizeof(*tq));
170 if(!tq) return NULL; 170 if(!tq) return NULL;
171 171
172 tq->start = NULL; 172 tq->start = NULL;
@@ -349,7 +349,7 @@ static void cndd_helper(cnd_t *cond) {
349ctqueue * ctqueue_init(int nthreads) { 349ctqueue * ctqueue_init(int nthreads) {
350 if(nthreads <= 0) ERRRET(EINVAL, NULL); 350 if(nthreads <= 0) ERRRET(EINVAL, NULL);
351 351
352 ctqueue *ctq = calloc(1, sizeof(*ctq)); 352 ctqueue *ctq = VXGG_CALLOC(1, sizeof(*ctq));
353 if(!ctq) return NULL; 353 if(!ctq) return NULL;
354 354
355 ctq->canceled = 0; 355 ctq->canceled = 0;
@@ -361,7 +361,7 @@ ctqueue * ctqueue_init(int nthreads) {
361 if(mtx_init(&ctq->mutex, mtx_plain) != thrd_success) goto ERR_ctqueue_init; 361 if(mtx_init(&ctq->mutex, mtx_plain) != thrd_success) goto ERR_ctqueue_init;
362 if(cnd_init(&ctq->cond) != thrd_success) goto ERR_ctqueue_init; 362 if(cnd_init(&ctq->cond) != thrd_success) goto ERR_ctqueue_init;
363 363
364 ctq->thrdarr = calloc(ctq->talen, sizeof(thrd_t)); 364 ctq->thrdarr = VXGG_CALLOC(ctq->talen, sizeof(thrd_t));
365 if(!ctq->thrdarr) goto ERR_ctqueue_init; 365 if(!ctq->thrdarr) goto ERR_ctqueue_init;
366 366
367 return ctq; 367 return ctq;