f94936c549
If two threads concurrently trigger initialization of the lazily populated ObjectStore members, they have to coordinate. We ensure mutual exclusion by holding a writer lock, to ensure only one thread can perform the lazy initialization. Furthermore we use store-release/load-acquire for those ObjectStore fields to ensure that once an object is made available on ObjectStore all of it's initializing stores are visible at that point. We no longer make public setters for those fields, since they shouldn't be used (only the getters + lazy initialization should be used) Fixes https://github.com/dart-lang/sdk/issues/46611 TEST=Fixes TSAN races reported on iso-stres builder. Change-Id: Icaf54bb224e74baf1bfbb4a9bfc386ebfbd52755 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206782 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Tess Strickland <sstrickl@google.com>