diff options
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/synctest.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/runtime/synctest.go b/src/runtime/synctest.go index 498c3b92dd..65bb15dfbb 100644 --- a/src/runtime/synctest.go +++ b/src/runtime/synctest.go @@ -182,6 +182,8 @@ func synctestRun(f func()) { sg.active++ for { if raceenabled { + // Establish a happens-before relationship between a timer being created, + // and the timer running. raceacquireg(gp, gp.syncGroup.raceaddr()) } unlock(&sg.mu) @@ -205,6 +207,11 @@ func synctestRun(f func()) { total := sg.total unlock(&sg.mu) + if raceenabled { + // Establish a happens-before relationship between bubbled goroutines exiting + // and Run returning. + raceacquireg(gp, gp.syncGroup.raceaddr()) + } if total != 1 { panic("deadlock: all goroutines in bubble are blocked") } |
