From 55a69489cd8a437c13cf715248a4e6c200512941 Mon Sep 17 00:00:00 2001 From: "henryk@ploetzli.ch" Date: Tue, 22 Dec 2009 20:32:40 +0000 Subject: [PATCH] Properly exit usb thread (e.g. on Ctrl-D) --- client/proxmark3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/proxmark3.c b/client/proxmark3.c index 05c2fe2d..2e8ef418 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -44,11 +44,11 @@ static void *usb_receiver(void *targ) { static void *main_loop(void *targ) { struct main_loop_arg *arg = (struct main_loop_arg*)targ; + struct usb_receiver_arg rarg; char *cmd = NULL; pthread_t reader_thread; if (arg->usb_present == 1) { - struct usb_receiver_arg rarg; rarg.run=1; pthread_create(&reader_thread, NULL, &usb_receiver, &rarg); } @@ -67,6 +67,11 @@ static void *main_loop(void *targ) break; } } + + if (arg->usb_present == 1) { + rarg.run = 0; + pthread_join(reader_thread, NULL); + } ExitGraphics(); pthread_exit(NULL); -- 2.39.2