Skip to content

Commit

Permalink
Fix race of WaitGroup Done before Add
Browse files Browse the repository at this point in the history
  • Loading branch information
unicell committed May 20, 2016
1 parent 634428f commit cfabeaa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jobpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ func addJob(job Job, pending chan<- Job) {
glog.V(2).Infof("--> data - submitting chunk...")
glog.V(4).Infof("\n>\n%s<\n", string(job.GetData()))

pending <- job
inWg.Add(1)
pending <- job
}

func initJobPool(args []string, r io.Reader, pending chan Job) {
Expand Down
2 changes: 1 addition & 1 deletion worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func Worker(in <-chan Job, out chan<- Job) {
glog.Errorf("Error executing %v", err)
continue
}
out <- j
outWg.Add(1)
out <- j
}
}

Expand Down

0 comments on commit cfabeaa

Please sign in to comment.