pgraph, resources: Clean up the event system around the resources
This cleans up some of the resource events and also reorganizes the struct for simplicity. This should hopefully kill off at least one race which would cause unnecessary blocking! Yes this patch is a bit yucky, but so was the bug I was fighting with!
This commit is contained in:
@@ -677,6 +677,7 @@ func (g *Graph) Exit() {
|
||||
// XXX: we can do this to quiesce, but it's not necessary now
|
||||
|
||||
v.SendEvent(event.EventExit, nil)
|
||||
v.Res.WaitGroup().Wait()
|
||||
}
|
||||
g.wg.Wait() // for now, this doesn't need to be a separate Wait() method
|
||||
}
|
||||
|
||||
@@ -588,6 +588,7 @@ func (g *Graph) GraphSync(oldGraph *Graph) (*Graph, error) {
|
||||
if !VertexContains(v, vertexKeep) {
|
||||
// wait for exit before starting new graph!
|
||||
v.SendEvent(event.EventExit, nil) // sync
|
||||
v.Res.WaitGroup().Wait()
|
||||
oldGraph.DeleteVertex(v)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user