From 1313875b02c690ca5a40e585d24fdec240bb419d Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 26 Jun 2023 15:04:13 -0400 Subject: thread: Wrap more pthread APIs --- src/ioq.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/ioq.c') diff --git a/src/ioq.c b/src/ioq.c index 457ead7..1160b34 100644 --- a/src/ioq.c +++ b/src/ioq.c @@ -9,7 +9,7 @@ #include "config.h" #include "diag.h" #include "dir.h" -#include "lock.h" +#include "thread.h" #include "sanity.h" #include #include @@ -335,8 +335,7 @@ struct ioq *ioq_create(size_t depth, size_t nthreads) { } for (size_t i = 0; i < nthreads; ++i) { - errno = pthread_create(&ioq->threads[i], NULL, ioq_work, ioq); - if (errno != 0) { + if (thread_create(&ioq->threads[i], NULL, ioq_work, ioq) != 0) { goto fail; } ++ioq->nthreads; @@ -417,9 +416,7 @@ void ioq_destroy(struct ioq *ioq) { ioq_cancel(ioq); for (size_t i = 0; i < ioq->nthreads; ++i) { - if (pthread_join(ioq->threads[i], NULL) != 0) { - abort(); - } + thread_join(ioq->threads[i], NULL); } ioqq_destroy(ioq->ready); -- cgit v1.2.3