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)