diff options
| author | @syxhe <https://t.me/syxhe> | 2026-01-08 01:59:36 -0600 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2026-01-08 02:32:39 -0600 |
| commit | 9edd12e87874eabdc74e45359a5228558e124c98 (patch) | |
| tree | dc18bc660675991670dc8792852f253a9531b9fd /src/threadpool.c | |
| parent | e814f6bcc2c66b249348f80c1307b98778fd7ae9 (diff) | |
Add clay to project
Diffstat (limited to 'src/threadpool.c')
| -rw-r--r-- | src/threadpool.c | 10 |
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 { | |||
| 76 | task * task_new(gcallback callback, fcallback freecb, void *data) { | 76 | task * 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) { | |||
| 129 | tqnode * tqnode_new(tqnode *next, tqnode *prev, task *tsk) { | 129 | tqnode * 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 | */ |
| 168 | taskqueue * taskqueue_new(void) { | 168 | taskqueue * 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) { | |||
| 349 | ctqueue * ctqueue_init(int nthreads) { | 349 | ctqueue * 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; |
