mirror of
https://github.com/greatscottgadgets/hackrf.git
synced 2026-03-09 16:59:08 +01:00
Rather than using sleep() for 1s at a time, set up an interval timer that will fire once per second, and wait in the main loop for either this or some other event. On POSIX, the timing is set up with setitimer(), which generates a SIGALRM signal each time the timer fires. The main loop runs pause() to wait for any signal. On Windows, the timing is set up using CreateWaitableTimer, which provides an event handle that is set each time the timer fires. The main loop runs WaitForMultipleObjects() to wait on this and an interrupt event. The TX and RX callbacks can now stop the main loop immediately when they stop streaming. This fixes #1019.