From b8d33bfd820953982093b7a7db154a58d7f7bd9e Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Sun, 25 Aug 2019 17:34:20 +0200 Subject: lib: wait for sample worker thread before freeing buffers This fixes a segfault when exiting, as sometimes it occured that the USB worker thread completed before the sample worker thread, and the buffers the latter was still accessing had already been freed. --- src/libosmo-fl2k.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libosmo-fl2k.c b/src/libosmo-fl2k.c index 7748238..0b03254 100644 --- a/src/libosmo-fl2k.c +++ b/src/libosmo-fl2k.c @@ -777,6 +777,8 @@ static void *fl2k_usb_worker(void *arg) } } + /* wait for sample worker thread to finish before freeing buffers */ + pthread_join(dev->sample_worker_thread, NULL); _fl2k_free_async_buffers(dev); dev->async_status = next_status; -- cgit v1.2.3