Understanding Swift's value type thread safety

Not necessarily, isKnownUniquelyReferenced doesn't handle race.

But then you are not following the "Swift rules".

If you have two values that reference the same object, then a race on the references inside the values are OK, as they are different references to the same object. So they contain the same bits, but they are separate references.

So isKnownUniquelyReferenced(&a.ref) racing with isKnownUniquelyReferenced(&b.ref) is all fine, but isKnownUniquelyReferenced(&a.ref) racing with isKnownUniquelyReferenced(&a.ref) is of course not, and would violate the exclusivity rule.

As long as you follow the simple Rule of Thumb that I outlined above, isKnownUniquelyReferenced() can be considered atomic (with the documented exceptions like weak, and possibly returning false even if unique).