Add additional logging to wait call to know the list of routines active when wait is called.

This commit is contained in:
Mark Beamer Jr 2019-08-25 16:09:50 -04:00
parent 7558397877
commit 26b0c7356d
No known key found for this signature in database
GPG key ID: 1C314FB89AD76973

View file

@ -70,6 +70,11 @@ func (s *Group) StopAndWait() {
s.Wait() s.Wait()
} }
func (s *Group) Wait() {
defer s.Wait()
s.listWaitingOn()
}
// Child returns a new instance that will be stopped when s is stopped. // Child returns a new instance that will be stopped when s is stopped.
func (s *Group) Child() *Group { func (s *Group) Child() *Group {
return New(s) return New(s)
@ -112,9 +117,16 @@ func (s *Group) DoneNamed(name string) {
} else { } else {
log.Printf("%s is not recorded in stop group map", name) log.Printf("%s is not recorded in stop group map", name)
} }
s.mu.Unlock()
s.listWaitingOn()
}
}
func (s *Group) listWaitingOn() {
if s.waitingOn != nil {
s.mu.Lock()
defer s.mu.Unlock()
log.Printf("-->> LIST ROUTINES WAITING ON") log.Printf("-->> LIST ROUTINES WAITING ON")
for k, v := range s.waitingOn { for k, v := range s.waitingOn {
if v > 0 { if v > 0 {
log.Printf("waiting on %d %s routines...", v, k) log.Printf("waiting on %d %s routines...", v, k)