lang: Add mutex around Expr String/Value/SetValue calls
The golang race detector complains about some unimportant races, and as a result, this patch adds some mutexes to prevent these test failures. We actually lock more than necessary, because a more accurate version would be more time consuming to implement. Secondarily, it's likely that in the future we replace this function graph algorithm with something that is guaranteed to be glitch-free and supports back pressure.
This commit is contained in:
@@ -93,6 +93,7 @@ func runInterpret(code string) (*pgraph.Graph, error) {
|
||||
return errwrap.Wrapf(lang.Close(), "close failed")
|
||||
}
|
||||
|
||||
// we only wait for the first event, instead of the continuous stream
|
||||
select {
|
||||
case err, ok := <-lang.Stream():
|
||||
if !ok {
|
||||
@@ -103,7 +104,7 @@ func runInterpret(code string) (*pgraph.Graph, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// run artificially without the entire engine
|
||||
// run artificially without the entire GAPI loop
|
||||
graph, err := lang.Interpret()
|
||||
if err != nil {
|
||||
err := errwrap.Wrapf(err, "interpret failed")
|
||||
|
||||
Reference in New Issue
Block a user