toolchain: mxdbg: fix extra context threads hanging on exit
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <magenta/debug/packet.h>
|
#include <magenta/debug/packet.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@@ -26,7 +27,14 @@ void debug_context_cleanup(struct debug_context *ctx)
|
|||||||
close(ctx->ctx_sock);
|
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_packet_thread, NULL);
|
||||||
|
pthread_join(ctx->ctx_event_thread, NULL);
|
||||||
|
printf("threads joined\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *packet_thread(void *arg)
|
static void *packet_thread(void *arg)
|
||||||
|
|||||||
Reference in New Issue
Block a user