So I am using ThreadSanitizer, and I find myself cleaning up data races that don't matter, in order to keep the output clean. (For example, an atomic set of a flag, where another thread reads that flag word, but doesn't care about that flag). On the one hand,
you might actually be doing that atomic flag set wrong, I just tried a test program that atomically sets/clears different bits of a global variable and didn't get any noise from tsan. here's my test code which you can flip between atomic and non-atomic:https://gist.github.com/tbodt/d390c205d29f7d49e89597ec578f276a …
-
-
Weird. It is just an atomic or, not a whole lot seems like it could happen incorrectly...
-
Oh. My read is non-atomic, which is in fact okay on these CPUs, but tsan doesn’t care. But it’s the same design issue either way — to fix that, I don’t want to slow down all reads of the flag word with atomics, so I would break it into a different word anyway.
- Još 5 drugih odgovora
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.