1
0
mirror of https://github.com/golang/go synced 2024-11-20 04:54:44 -07:00

Avoid race condition. Following the left to right rule,

s.output.Data() was being retrieved before the synchronization
point, which meant that it could be retrieved before the
goroutine wrote it.  Using gccgo this caused random errors.

R=gri
DELTA=2  (1 added, 0 deleted, 1 changed)
OCL=31046
CL=31267
This commit is contained in:
Ian Lance Taylor 2009-07-07 10:15:01 -07:00
parent 27432d67ec
commit 5abf395be7

View File

@ -745,7 +745,8 @@ func (f Format) Eval(env Environment, args ...) ([]byte, os.Error) {
errors <- nil; // no errors
}();
return s.output.Data(), <- errors;
err := <- errors;
return s.output.Data(), err;
}