Mercurial > gemma
comparison pkg/mesh/raster.go @ 5469:1a89084163d5
Fixed data race in diff calculation by adding two forgotten waitgroup waits.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 19 Jul 2021 17:58:02 +0200 |
parents | 34bc6041e61e |
children | 5f47eeea988d |
comparison
equal
deleted
inserted
replaced
5467:df1b2c5ae541 | 5469:1a89084163d5 |
---|---|
112 | 112 |
113 for i := 0; i < r.YCells; i++ { | 113 for i := 0; i < r.YCells; i++ { |
114 rows <- i | 114 rows <- i |
115 } | 115 } |
116 close(rows) | 116 close(rows) |
117 wg.Wait() | |
117 } | 118 } |
118 | 119 |
119 func (r *Raster) Diff(eval func(float64, float64) (float64, bool)) { | 120 func (r *Raster) Diff(eval func(float64, float64) (float64, bool)) { |
120 var wg sync.WaitGroup | 121 var wg sync.WaitGroup |
121 | 122 |
175 | 176 |
176 for i := 0; i < r.YCells; i++ { | 177 for i := 0; i < r.YCells; i++ { |
177 rows <- i | 178 rows <- i |
178 } | 179 } |
179 close(rows) | 180 close(rows) |
181 wg.Wait() | |
180 } | 182 } |
181 | 183 |
182 func (r *Raster) ZExtent() (float64, float64, bool) { | 184 func (r *Raster) ZExtent() (float64, float64, bool) { |
183 min, max := math.MaxFloat64, -math.MaxFloat64 | 185 min, max := math.MaxFloat64, -math.MaxFloat64 |
184 for _, v := range r.Cells { | 186 for _, v := range r.Cells { |