diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c index 7b909861..e138cb87 100644 --- a/host/libhackrf/src/hackrf.c +++ b/host/libhackrf/src/hackrf.c @@ -27,6 +27,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI #include #ifndef _WIN32 #include + #include #endif #include @@ -1763,6 +1764,20 @@ static void* transfer_threadproc(void* arg) int error; struct timeval timeout = {0, 500000}; + /* + * hackrf_transfer uses pause() and SIGALRM to print statistics and + * POSIX doesn't specify which thread must recieve the signal, block all + * signals here, so we don't interrupt their reception by + * hackrf_transfer or any other app which uses the library (#1323) + */ +#ifndef _WIN32 + sigset_t signal_mask; + sigfillset(&signal_mask); + if (pthread_sigmask(SIG_BLOCK, &signal_mask, NULL) != 0) { + return NULL; + } +#endif + while (device->do_exit == false) { error = libusb_handle_events_timeout(g_libusb_context, &timeout); if ((error != 0) && (error != LIBUSB_ERROR_INTERRUPTED)) {