Xcode ThreadSanitizer warns about SmoothedValue - can I disregard it?

There’s not enough information to say for sure.

The SmoothedValue doesn’t provide any threading guarantees beyond the baseline that you’d expect from any class. Calling any non-const member function of SmoothedValue simultaneously with any other member function of SmoothedValue is not safe. If you’re doing that, then the problem is in your code. Thread sanitizer will show you the call stacks that lead to a particular data race, so you should be able to work out whether you’re modifying a SmoothedValue from the main thread while reading from it on the audio thread.

If that does turn out to be the problem, then you could consider restructuring your code so that you don’t directly modify SmoothedValues from the main thread; instead, the smoothed values can check a parameter value (or similar) during the audio callback and set their state appropriately at that point.

2 Likes