Skip to content

Commit

Permalink
Defer the close(result) in Parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
Southern committed Jun 21, 2014
1 parent 42db4cb commit 8335b18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parallel.go
Expand Up @@ -65,6 +65,8 @@ func (l *List) RunParallel(callbacks ...Done) {
}
)

defer close(result)

l.Wait.Add(l.Len())

go func() {
Expand Down Expand Up @@ -104,8 +106,6 @@ func (l *List) RunParallel(callbacks ...Done) {

l.Wait.Wait()

close(result)

if _error == nil {
final(nil, results...)
}
Expand Down

0 comments on commit 8335b18

Please sign in to comment.