summaryrefslogtreecommitdiffstats
path: root/src/ioq.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-11-26 14:31:22 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-11-27 21:03:36 -0500
commit46e0c0bccbee21903efc9c924874970e251dde48 (patch)
treef248864843698d70fd065469fe41c414945c9b78 /src/ioq.c
parentf05d65e5cf4b376a6bf1eeed17356f8e7767b389 (diff)
downloadbfs-46e0c0bccbee21903efc9c924874970e251dde48.tar.xz
ioq: Set the worker thread names to ioq-%d
Diffstat (limited to 'src/ioq.c')
-rw-r--r--src/ioq.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ioq.c b/src/ioq.c
index 02985da..1c5524e 100644
--- a/src/ioq.c
+++ b/src/ioq.c
@@ -918,7 +918,8 @@ static void ioq_ring_exit(struct ioq_thread *thread) {
}
/** Create an I/O queue thread. */
-static int ioq_thread_create(struct ioq *ioq, struct ioq_thread *thread) {
+static int ioq_thread_create(struct ioq *ioq, size_t i) {
+ struct ioq_thread *thread = &ioq->threads[i];
thread->parent = ioq;
ioq_ring_init(ioq, thread);
@@ -928,6 +929,11 @@ static int ioq_thread_create(struct ioq *ioq, struct ioq_thread *thread) {
return -1;
}
+ char name[16];
+ if (snprintf(name, sizeof(name), "ioq-%zu", i) >= 0) {
+ thread_setname(thread->id, name);
+ }
+
return 0;
}
@@ -962,7 +968,7 @@ struct ioq *ioq_create(size_t depth, size_t nthreads) {
ioq->nthreads = nthreads;
for (size_t i = 0; i < nthreads; ++i) {
- if (ioq_thread_create(ioq, &ioq->threads[i]) != 0) {
+ if (ioq_thread_create(ioq, i) != 0) {
ioq->nthreads = i;
goto fail;
}