I learned that TSAN doesn't understand std::atomic_thread_fence
, and to fix it, you need to tell TSAN which atomic variables are affected by the fence, by putting __tsan_acquire(void *)
and __tsan_release(void *)
next to it (for acquire and release fences respectively).
But what about seq-cst fences? As I understand, they're more strict than acq-rel fences, so acq-rel annotations might not be enough?
I'm not too familiar with different memory orders, so I might be missing something.
@dvyukov on Github confirmed the __tsan_acquire
+__tsan_release
instrumentation (same as for acq-rel fences) should be enough.
I'm not sure if it means that TSAN doesn't distinguish between seq-cst and acq-rel operations in general, or not.