aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--klippy/serialqueue.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/klippy/serialqueue.c b/klippy/serialqueue.c
index 444c5ea4..23ed6858 100644
--- a/klippy/serialqueue.c
+++ b/klippy/serialqueue.c
@@ -448,6 +448,15 @@ check_wake_receive(struct serialqueue *sq)
}
}
+// Write to the internal pipe to wake the background thread if in poll
+static void
+kick_bg_thread(struct serialqueue *sq)
+{
+ int ret = write(sq->pipe_fds[1], ".", 1);
+ if (ret < 0)
+ report_errno("pipe write", ret);
+}
+
// Update internal state when the receive sequence increases
static void
update_receive_seq(struct serialqueue *sq, double eventtime, uint64_t rseq)
@@ -832,6 +841,7 @@ void
serialqueue_exit(struct serialqueue *sq)
{
pollreactor_do_exit(&sq->pr);
+ kick_bg_thread(sq);
int ret = pthread_join(sq->tid, NULL);
if (ret)
report_errno("pthread_join", ret);
@@ -848,15 +858,6 @@ serialqueue_alloc_commandqueue(void)
return cq;
}
-// Write to the internal pipe to wake the background thread if in poll
-static void
-kick_bg_thread(struct serialqueue *sq)
-{
- int ret = write(sq->pipe_fds[1], ".", 1);
- if (ret < 0)
- report_errno("pipe write", ret);
-}
-
// Add a batch of messages to the given command_queue
void
serialqueue_send_batch(struct serialqueue *sq, struct command_queue *cq