aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2026-02-18 11:33:56 -0500
committerCherry Mui <cherryyz@google.com>2026-02-18 10:38:22 -0800
commitf40560ff89eac34709f5fee56ebf71bfb2c4065c (patch)
tree30beba378423a143391fb59c6c62219b89022a7f /src/runtime/runtime2.go
parent50b63f6cb90a1437ca6756ede016f1918e721da6 (diff)
downloadgo-f40560ff89eac34709f5fee56ebf71bfb2c4065c.tar.xz
runtime: tell the race detector about synchronization on mainInitDone
CL 743940 puts an atomic bool initialization-done channel, which is a nice optimization. In race mode, however, the atomic bool does not have race instrumentation, so the race detector doesn't know the happens-before edge between the initialization and the cgo callback. To tell the race detector about this synchronization, just use the channel unconditionally in race mode. Channel operations have the proper race instrumentation. Alternatively, we could explicitly instrument the atomic boolean operations. TODO: write a test. Change-Id: I466b20a46cd39d2bbe2149a9009e1a01b15891e2 Reviewed-on: https://go-review.googlesource.com/c/go/+/746581 Reviewed-by: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/runtime2.go')
0 files changed, 0 insertions, 0 deletions