diff options
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/cgocall.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/runtime/cgocall.go b/src/runtime/cgocall.go index 7f05c13aee..626f7edf01 100644 --- a/src/runtime/cgocall.go +++ b/src/runtime/cgocall.go @@ -428,7 +428,10 @@ func cgocallbackg1(fn, frame unsafe.Pointer, ctxt uintptr) { // // We check a bool first for speed, and wait on a channel // if it's not ready. - if !mainInitDone.Load() { + // + // In race mode, skip the optimization and always use the + // channel, which has the race instrumentation. + if raceenabled || !mainInitDone.Load() { <-mainInitDoneChan } } |
