Skip to content

Commit

Permalink
switch shutdown functions from exclusive to shared lock
Browse files Browse the repository at this point in the history
  • Loading branch information
arnecls committed Apr 16, 2019
1 parent b1e344e commit c977963
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions producer/spooling.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,10 @@ func (prod *Spooling) routeToOrigin(msg *core.Message) {
}

func (prod *Spooling) waitForReader() {
prod.outfileGuard.Lock()
defer prod.outfileGuard.Unlock()
prod.outfileGuard.RLock()
defer prod.outfileGuard.RUnlock()

outfiles := prod.outfile
for _, spool := range outfiles {
for _, spool := range prod.outfile {
spool.waitForReader()
}
}
Expand All @@ -276,8 +275,9 @@ func (prod *Spooling) close() {
}
prod.DefaultClose()

prod.outfileGuard.Lock()
defer prod.outfileGuard.Unlock()
prod.outfileGuard.RLock()
defer prod.outfileGuard.RUnlock()

for _, spool := range prod.outfile {
spool.close()
}
Expand Down

0 comments on commit c977963

Please sign in to comment.