diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-06-26 15:04:13 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-06-26 15:04:13 -0400 |
commit | 1313875b02c690ca5a40e585d24fdec240bb419d (patch) | |
tree | 6cd7733b8e3ae07129955fcb627f313032456f10 /src/ioq.c | |
parent | abd29143d805fa16c65489d5b1d79428943d0187 (diff) | |
download | bfs-1313875b02c690ca5a40e585d24fdec240bb419d.tar.xz |
thread: Wrap more pthread APIs
Diffstat (limited to 'src/ioq.c')
-rw-r--r-- | src/ioq.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -9,7 +9,7 @@ #include "config.h" #include "diag.h" #include "dir.h" -#include "lock.h" +#include "thread.h" #include "sanity.h" #include <assert.h> #include <errno.h> @@ -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); |