Using _MSC_VER here means that the choice of signal() versus
SetConsoleCtrlHandler depends on the compiler being used, rather
than the OS being targeted. When built with MinGW rather than MSVC,
this happens to work because MinGW's signal emulation is used, but
that emulation is quite limited.
Instead, be consistent and use the Win32 API when building for that
platform, regardless of compiler.
Note that if building for Cygwin, _WIN32 is not defined and POSIX
APIs are used.
On rad1o, the UI update could block this loop from running for long
enough that it could stall in a state where neither of the conditions
was met.
Fix this by removing the 'phase' variable, in favour of a counter
tracking the number of bytes that have been scheduled for USB transfer.
Whenever there are enough bytes to schedule the next transfer, do so.
Meanwhile, the M0 count is prevented from wrapping around and clobbering
data not yet sent, because the M0 code monitors the m4_count variable
which is updated as each transfer completes.
I believe this was safe before, because this code is only called from
the transfer thread, and the condition being protected is just whether
the count is zero, not the actual value of the count.
However, this isn't performance critical and it's a lot easier to
reason about the code if we just hold the lock for this whole section.
This simplifies the code required to wait for cancellations to complete.
The condition variable now reflects whether `active_transfers == 0`, and
the associated lock must be held to decrement that count to zero.
The existing 'delay' function is not calibrated to any specific measure
of time. Add a new function using a loop with a known cycle count, to
produce delays of a given duration at a given CPU clock speed.
* jenkins: initial commit
* jenkins: add missing usb hub check script
* jenkins: squish docker apt package install commands into a single command
* jenkins: fix type in Dockerfile
* jenkins: override interactive installations in Dockerfile (build-essentials fails due to tzdata)
* jenkins: set executable flag on ci scripts
* jenkins: remove sudo prefix from install scripts
* jenkins: add python3 venv to Dockerfile and build scripts
* jenkins: add missing python venv command to host install script
* jenkins: remove python install and venv redundancies
* jenkins: remove make install step, run hackrf tools directly from their build directory
* jenkins: re-add python3 and pip installations to docker because usbhub depends on them
* jenkins: add missing git install to docker
* jenkins: add python-is-python3 to docker's installed dependencies
* jenkins: use path string to specify the correct device for dfu-util
* jenkins: specify usbhub id for dual hub setup
* jenkins: turn unused usb hub ports off for testing
* jenkins: remove custom job throttle property
* use --disable-i2c usbhub option, install usbhub from latest, replace --privileged with cgroups option, remove redundancies from Dockerfile
* update device usb path for dfu-util
* remove apt/lists/* and fix typos
* ci: remove redundant environment setup in Jenkins