summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-19 08:22:24 +0200
committerPaul Buetow <paul@buetow.org>2026-03-19 08:22:24 +0200
commit766509856dab2bd9daa9f407daad8c1b47c2f098 (patch)
tree0918a80f04338a43c09ef72cd2557f0e8f84c82f
parent84d420aece99abd932fdd76279bf54a1bda527fe (diff)
fix: avoid recycling threads with pending work (task 478)
-rw-r--r--ioriot/src/replay/rthread.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ioriot/src/replay/rthread.c b/ioriot/src/replay/rthread.c
index ae0a597..6bbf4f9 100644
--- a/ioriot/src/replay/rthread.c
+++ b/ioriot/src/replay/rthread.c
@@ -121,6 +121,10 @@ void *rthread_pthread_start(void *data)
// Make the rthread reusable, he is without any tasks
// for some time.
pthread_mutex_lock(&w->rthread_buffer_mutex);
+ if (rbuffer_has_next(t->tasks)) {
+ pthread_mutex_unlock(&w->rthread_buffer_mutex);
+ break;
+ }
inserted = rbuffer_insert(w->rthread_buffer, t);
pthread_mutex_unlock(&w->rthread_buffer_mutex);
}