summaryrefslogtreecommitdiffstats
path: root/src/ioq.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-06-26 15:04:13 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-06-26 15:04:13 -0400
commit1313875b02c690ca5a40e585d24fdec240bb419d (patch)
tree6cd7733b8e3ae07129955fcb627f313032456f10 /src/ioq.c
parentabd29143d805fa16c65489d5b1d79428943d0187 (diff)
downloadbfs-1313875b02c690ca5a40e585d24fdec240bb419d.tar.xz
thread: Wrap more pthread APIs
Diffstat (limited to 'src/ioq.c')
-rw-r--r--src/ioq.c9
1 files changed, 3 insertions, 6 deletions
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 <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);