Actually pause mutators when adding dependencies (#335)
In the coordination between #316 and #318 the calls to mctx.pause() were forgotten, causing dependencies returned by the Add*Dependency calls to be in an undefined state. Add the missing calls to mctx.pause(). Change-Id: I648ad269449777363801785059b13b866424d4b5
This commit is contained in:
parent
9ae14f12f9
commit
cfa2e91dc4
1 changed files with 19 additions and 10 deletions
|
@ -1102,7 +1102,9 @@ func (mctx *mutatorContext) AddDependency(module Module, tag DependencyTag, deps
|
|||
if len(errs) > 0 {
|
||||
mctx.errs = append(mctx.errs, errs...)
|
||||
}
|
||||
depInfos = append(depInfos, maybeLogicModule(depInfo))
|
||||
if mctx.pause(depInfo) {
|
||||
depInfos = append(depInfos, maybeLogicModule(depInfo))
|
||||
}
|
||||
}
|
||||
return depInfos
|
||||
}
|
||||
|
@ -1133,7 +1135,9 @@ func (mctx *mutatorContext) AddVariationDependencies(variations []Variation, tag
|
|||
if len(errs) > 0 {
|
||||
mctx.errs = append(mctx.errs, errs...)
|
||||
}
|
||||
depInfos = append(depInfos, maybeLogicModule(depInfo))
|
||||
if mctx.pause(depInfo) {
|
||||
depInfos = append(depInfos, maybeLogicModule(depInfo))
|
||||
}
|
||||
}
|
||||
return depInfos
|
||||
}
|
||||
|
@ -1147,7 +1151,9 @@ func (mctx *mutatorContext) AddFarVariationDependencies(variations []Variation,
|
|||
if len(errs) > 0 {
|
||||
mctx.errs = append(mctx.errs, errs...)
|
||||
}
|
||||
depInfos = append(depInfos, maybeLogicModule(depInfo))
|
||||
if mctx.pause(depInfo) {
|
||||
depInfos = append(depInfos, maybeLogicModule(depInfo))
|
||||
}
|
||||
}
|
||||
return depInfos
|
||||
}
|
||||
|
@ -1202,16 +1208,19 @@ func (mctx *mutatorContext) CreateModule(factory ModuleFactory, props ...interfa
|
|||
|
||||
// pause waits until the given dependency has been visited by the mutator's parallelVisit call.
|
||||
// It returns true if the pause was supported, false if the pause was not supported and did not
|
||||
// occur, which will happen when the mutator is not parallelizable.
|
||||
// occur, which will happen when the mutator is not parallelizable. If the dependency is nil
|
||||
// it returns true if pausing is supported or false if it is not.
|
||||
func (mctx *mutatorContext) pause(dep *moduleInfo) bool {
|
||||
if mctx.pauseCh != nil {
|
||||
unpause := make(unpause)
|
||||
mctx.pauseCh <- pauseSpec{
|
||||
paused: mctx.module,
|
||||
until: dep,
|
||||
unpause: unpause,
|
||||
if dep != nil {
|
||||
unpause := make(unpause)
|
||||
mctx.pauseCh <- pauseSpec{
|
||||
paused: mctx.module,
|
||||
until: dep,
|
||||
unpause: unpause,
|
||||
}
|
||||
<-unpause
|
||||
}
|
||||
<-unpause
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
Loading…
Reference in a new issue