Per POSIX definition, pthread_cond_timedwait() re-acquires the mutex
when a timeout occurs and ETIMEDOUT is returned. In that case also
mark the waiting thread as owner again, for consistency.
Otherwise subsequent attempts to unlock the mutex will fail, leaving
the mutex locked forever.
This makes waf compatible with Python 3.12 again.
Also, apply modifications needed for MacOS and add as a patch file (see
commits 0f2e3b2 and dc6c995).
Signed-off-by: Nils Philippsen <nils@tiptoe.de>
* Rework the seqmidi aliases.
- The 1st alias is now the Jack1 MIDI port name with alsa_midi prefix.
- This 2nd alias is basically the same as the 1st alias with the
alsa_midi prefix stripped, so that devices are listed under the ALSA
names.
Also fixed the "capture" and "playback" port type names which were the
wrong way round.
* Rework the rawmidi alias.
Like in alsa_seqmidi.c, the 1st alias is now the Jack1 MIDI port name
with alsa_midi prefix.
* Rework pretty-name metadata.
The rawmidi and seqmidi pretty-name metadata now uses the same Jack1
port name as the 1st alias, without the alsa_midi: prefix.
* rework and cleanup CI setup
Signed-off-by: falkTX <falktx@falktx.com>
* continue CI cleanup
Signed-off-by: falkTX <falktx@falktx.com>
* Only use --mixed for win64
Signed-off-by: falkTX <falktx@falktx.com>
---------
Signed-off-by: falkTX <falktx@falktx.com>
* fix ringbuffer thread safety on ARM. fix#715#388
This patch addresses the thread safety problem of `jack_ringbuffer_t`
mentioned in #715 and #388. The overbound read bug caused by this problem
is impossible to reproduce on x86 due to its strong memory ordering, but
it is a problem on ARM and other weakly ordered architectures.
Basically, the main problem is that, on a weakly ordered architecture,
it is possible that the pointer increment after `memcpy` becomes visible
to the other thread before `memcpy` finishes:
memcpy (&(rb->buf[rb->write_ptr]), src, n1);
// vvv can be visible to reading thread before memcpy finishes
rb->write_ptr = (rb->write_ptr + n1) & rb->size_mask;
If this happens, the other thread can read the remaining garbage values
in `rb->buf` due to be overwritten by the unfinished `memcpy`.
To fix this, an explicit pair of release/acquire memory fences [1] is
used to ensure the copy on the other thread *happens after* the `memcpy`
finishes so no garbage values can be read.
[1]: https://preshing.com/20130922/acquire-and-release-fences/
* remove volatile qualifier on ringbuf r/w pointers
The volatile constraints are excess when compiler barriers are present.
It generates unnecessary `mov` instructions when pointers aren't going
to be updated.
* simplify read/write space calculations
This optimization is possible because the buffer size is always a power
of 2. See [1] for details.
[1]: https://github.com/drobilla/zix/pull/1#issuecomment-1212687196
* move acq fences to separate lines
Reduce the base latencies for capture and playback by half a period,
and let the update method account for the additional playback latency
introduced by OSS buffer management.
This fits actual OSS latencies better, so the same settings for the
extra input-latency and output-latency parameters should apply to
different period lengths.
Beware that this change invalidates current input-latency and
output-latency values, they have to be measured again.
dbus/jack_control:
Remove unused imports for os and traceback.print_exc.
Fix indentation, whitespace and line length issues across the entire
file.
Simplify printing in `print_help()` by calling `print()` only once.