WIP for thread sanitizer improvement
Hello here, I use cyclonedds as a dependency of my project, and found that cyclonedds mix using gcc __sync built-in and arch-specified behavior and also disable tsan for some ops, which make it play not well with thread sanitizer. so I did a quick hack to replace them with new __atomic built-in (which supported by gcc and thread sanitizer https://github.com/google/sanitizers/wiki/ThreadSanitizerAtomicOperations) , make it "theoretically tsan warning free" (if all othe places using thread primitives correctly)
but running cyclonedds test shows that there're also some issues which can't be easily detected without thread sanitizer (all tests in my branch also pass all cunit assert check ). for example ddsi_proxy_reader declare serval member as bit field which live in one byte, but being read/write from different thread. there're also some issues that I don't have enough knowledge to resolve, so I put this WIP branch here to get some feedback, I wonder if we have plan to achieve a tsan warning free codebase (or even further, tsan build/test became part of CI check), or we still prefer current atomic implementation ?
I've put the tsan log here, which already removed similar stack trace and non-important ones from tests. output.log