rtl_adsb: fix hanging upon a signal in Fedora 27

This code stayed unchanged for many years, but for some reason
rtl_adsb started hanging upon exit:

^CSignal caught, exiting!
 <------ hangs here forever

Examining it with gdb reveals that the demod thread waits
peacefully on the condition variable, which we're trying to
destroy. Either the signals killed all threads before, or
condition variables were possible to destroy while other
threads still waited on them.

The easiest fix appears to be just cancel the demod thread
and wait for it to exit before proceeding for the door.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
Pete Zaitcev 2018-05-13 15:19:31 -05:00 committed by Steve Markgraf
parent a854ae8b48
commit ce9595ef53
1 changed files with 2 additions and 0 deletions

View File

@ -492,6 +492,8 @@ int main(int argc, char **argv)
else {
fprintf(stderr, "\nLibrary error %d, exiting...\n", r);}
pthread_join(demod_thread, NULL);