mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-05 07:36:14 +08:00
Properly exit usb thread (e.g. on Ctrl-D)
This commit is contained in:
parent
a665f74081
commit
55a69489cd
1 changed files with 6 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue