Stream: general

Topic: Data Races in Go/Swift?


RalfJ (Nov 28 2019 at 14:42, on Zulip):

I recently heard someone say that Data Races in Go are Undefined Behavior. Is that true? I was unable to find a definite answer in the Go docs, but this talk says

Races on interface, string, slice, map entries can still do arbitrarily bad things

That is really surprising because Go is also widely considered a "safe" language! Java at least gives defined semantics to its data races to earn the "safe" label.
And then I checked Swift and the situation superficially seems similar? Does anyone know more?

RalfJ (Nov 28 2019 at 14:53, on Zulip):

I find it rather amusing (or concerning) that the Go memory model literally says nothing about data races...

Muhammad Mominul Huque (Dec 08 2019 at 12:23, on Zulip):

"The Swift language guarantees memory safety in single threaded environments. However, conflicting accesses in multithreaded code lead to data races. "
https://swift.org/blog/tsan-support-on-linux/

RalfJ (Dec 11 2019 at 15:29, on Zulip):

sure, but are data races UB or are they handled gracefully (Java does the latter, AFAIK the same goes for C#)?

Last update: Dec 12 2019 at 00:50UTC