Closed mman closed 7 years ago
Hey Martin - to the best of my knowledge, they are indeed lockless and safe (I've been using them for years in stuff that's seen a huge amount of use). Could be the sanitiser's just been a bit overcautious?
That said, although I'm a CS grad and mostly know what I'm doing, I don't have any skills in stuff like formally proving that this is safe. I just think it is =)
Thanks @michaeltyson for confirming this. I have not received any related crashes so far either, I just wanted it here indexed by google if any other people stumble on this via XCode as well.
Since thread sanitizer is not reporting the same thing on the iOS (neither the device nor the simulator) I wonder whether there could be any differences in how the structures are laid out on iOS compiled for x86_64 and arm64 and macOS compiled for x86_64....
Looks like thread sanitizer thinks it can not guarantee atomicity of Read of size 8
and Write of size 8
on macOS, or perhaps that's because the code is compiled for i386 still?
That’s an interesting point - do Mac builds still include a 32 bit slice? Still not sure why that’d be an issue as TPCB uses 32 bit ints, though...
Any way of knowing what line is triggering those warnings? If it’s doing a 64-bit read/write maybe that’s the atomic int...
@michaeltyson Please ignore this issue. I discovered a problem in my git repo setup and I think I was probably running against a very old copy of TPCircularBuffer. Just git pull
-ed the 1.5 and re-tested the code and the thread sanitizer warnings are gone. Looks like they might have been just fixed ages ago on your side and I was just mistakenly stuck on an old version :)
Ah good!
Hi Michael,
I'm receiving the following thread sanitizer warning (and couple more) when running my app in debug mode on macOS High Sierra and XCode 9.
I'm not sure if I'm using TPCircularBuffer correctly and it seems that the same code is not an issue on the iOS.
The producer will use
TPCircularBufferCopyAudioBufferList
to fill data into the buffer, the consumer (render callback) usesTPCircularBufferDequeueBufferListFrames
to satisfy the render callback requirement...Am I doing this right? Are these lockless and thread safe on the macOS?
thanks, Martin