From 9af5aa2acf35a886b39e96254f5c90669eb1b001 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 7 Jun 2026 13:48:04 +0100 Subject: [PATCH] toolchain: mxdbg: fix extra context threads hanging on exit --- toolchain/mxdbg/client/context.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/toolchain/mxdbg/client/context.c b/toolchain/mxdbg/client/context.c index 02252cd..69f766d 100644 --- a/toolchain/mxdbg/client/context.c +++ b/toolchain/mxdbg/client/context.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -26,7 +27,14 @@ void debug_context_cleanup(struct debug_context *ctx) close(ctx->ctx_sock); } + pthread_cond_broadcast(&ctx->ctx_packet_cond); + pthread_kill(ctx->ctx_packet_thread, SIGINT); + pthread_kill(ctx->ctx_event_thread, SIGINT); + + printf("joining threads...\n"); pthread_join(ctx->ctx_packet_thread, NULL); + pthread_join(ctx->ctx_event_thread, NULL); + printf("threads joined\n"); } static void *packet_thread(void *arg)