krasjet
5dcea70362
move acq fences to separate lines
2 years ago
krasjet
d98f04113c
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
2 years ago
krasjet
5a75deab04
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.
2 years ago
krasjet
f4f567348b
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/
2 years ago
sletz
c83577f82c
EXPORT macro renamed to LIB_EXPORT.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4492 0c269be4-1314-0410-8aa9-9f06e86f4224
14 years ago
sletz
52993cd859
Add jack_flush_adapter API.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/branches/libjacknet@3953 0c269be4-1314-0410-8aa9-9f06e86f4224
15 years ago
sletz
5f68a6557a
rebase from trunk 3813:3899
git-svn-id: http://subversion.jackaudio.org/jack/jack2/branches/libjacknet@3900 0c269be4-1314-0410-8aa9-9f06e86f4224
15 years ago
sletz
f7cb14ec45
Fix for ticket #154 .
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3869 0c269be4-1314-0410-8aa9-9f06e86f4224
15 years ago
sletz
c303556637
Client debugging code improved.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3823 0c269be4-1314-0410-8aa9-9f06e86f4224
15 years ago
sletz
6b765f0168
rebase from trunk 3684:3813
git-svn-id: http://subversion.jackaudio.org/jack/jack2/branches/libjacknet@3814 0c269be4-1314-0410-8aa9-9f06e86f4224
15 years ago
sletz
eb85ac5668
Fix ringbuffer.c again.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3778 0c269be4-1314-0410-8aa9-9f06e86f4224
15 years ago
sletz
5914cf5115
Better memory allocation error checking in ringbuffer.c, weak import improvements.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3777 0c269be4-1314-0410-8aa9-9f06e86f4224
15 years ago
sletz
51fbf0cf71
rebase from trunk 3420:3447
git-svn-id: http://subversion.jackaudio.org/jack/jack2/branches/libjacknet@3448 0c269be4-1314-0410-8aa9-9f06e86f4224
16 years ago
sletz
0ce4b47215
Automatic adaptative ringbuffer size mode when -g = 0.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3423 0c269be4-1314-0410-8aa9-9f06e86f4224
16 years ago
sletz
171a3c4a0d
Client and library global context cleanup in case of incorrect shutdown handling (that is applications not correctly closing client after server has shutdown).
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3207 0c269be4-1314-0410-8aa9-9f06e86f4224
16 years ago
sletz
7f5f7dec44
Report ringbuffer.c fixes from jack1. Fix for ticket #102 .
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3126 0c269be4-1314-0410-8aa9-9f06e86f4224
16 years ago
sletz
82fb19ae07
Fix symbols export in ringbuffer.c.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3083 0c269be4-1314-0410-8aa9-9f06e86f4224
16 years ago
sletz
f19b74f904
Header cleanup, add --clients and --ports options in configure.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2957 0c269be4-1314-0410-8aa9-9f06e86f4224
16 years ago
sletz
3e01068967
Merge Michael Voigt drops branch after reorganization step.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2880 0c269be4-1314-0410-8aa9-9f06e86f4224
16 years ago
moret
2d323a8488
Remove JackCallbackAudioAdapter class - Add portaudio debug dll - Add dummy driver on windows
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2691 0c269be4-1314-0410-8aa9-9f06e86f4224
17 years ago
nedko
4ad5bd7b0c
Remove incusion of internal header from external header and thus fix building of non sequencer
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2485 0c269be4-1314-0410-8aa9-9f06e86f4224
17 years ago
sletz
a20801bf58
Better control of exported symbols.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2456 0c269be4-1314-0410-8aa9-9f06e86f4224
17 years ago
nedko
b5bd3afb28
Add conditional includes for config.h, for use with waf
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2423 0c269be4-1314-0410-8aa9-9f06e86f4224
17 years ago
sletz
0026513c0a
Cleanup
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1835 0c269be4-1314-0410-8aa9-9f06e86f4224
17 years ago
sletz
2fd68fdfbf
Reorganize jack headers.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1614 0c269be4-1314-0410-8aa9-9f06e86f4224
17 years ago
sletz
8057bf5451
Cleanup
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1578 0c269be4-1314-0410-8aa9-9f06e86f4224
17 years ago
sletz
74fcf9020d
Fix memory leak in ringbuffer.c
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1316 0c269be4-1314-0410-8aa9-9f06e86f4224
18 years ago
sletz
73e2d7a6d3
First import
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1195 0c269be4-1314-0410-8aa9-9f06e86f4224
18 years ago