Fix data race in a parallel singletons calling VisitAllModules
Force a resort of the module groups before running singletons so that two singletons running in parallel don't cause a data race when they trigger a resort in VisitAllModules. Test: go test -race ./... Change-Id: Iec041cec08c33c56787aadbde6a1b2b619815142
This commit is contained in:
parent
6bc984abca
commit
e70495ba9a
1 changed files with 4 additions and 0 deletions
|
@ -3520,6 +3520,10 @@ func (c *Context) generateSingletonBuildActions(config interface{},
|
|||
errs = append(errs, newErrs...)
|
||||
}
|
||||
|
||||
// Force a resort of the module groups before running singletons so that two singletons running in parallel
|
||||
// don't cause a data race when they trigger a resort in VisitAllModules.
|
||||
c.sortedModuleGroups()
|
||||
|
||||
// First, take care of any singletons that want to run in parallel.
|
||||
deps, errs = c.generateParallelSingletonBuildActions(config, singletons, liveGlobals)
|
||||
|
||||
|
|
Loading…
Reference in a new issue