]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Properly exit usb thread (e.g. on Ctrl-D)
authorhenryk@ploetzli.ch <henryk@ploetzli.ch@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Tue, 22 Dec 2009 20:32:40 +0000 (20:32 +0000)
committerhenryk@ploetzli.ch <henryk@ploetzli.ch@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Tue, 22 Dec 2009 20:32:40 +0000 (20:32 +0000)
client/proxmark3.c

index 05c2fe2d5681ac8359f0030e496a74a99a47e1fe..2e8ef41820e16da24ffd0c6530f37ada96df0b5d 100644 (file)
@@ -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;
 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) {
        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);
        }
                rarg.run=1;
                pthread_create(&reader_thread, NULL, &usb_receiver, &rarg);
        }
@@ -67,6 +67,11 @@ static void *main_loop(void *targ)
                        break;
                }
        }
                        break;
                }
        }
+       
+       if (arg->usb_present == 1) {
+               rarg.run = 0;
+               pthread_join(reader_thread, NULL);
+       }
 
        ExitGraphics();
        pthread_exit(NULL);
 
        ExitGraphics();
        pthread_exit(NULL);
Impressum, Datenschutz