Change-Id: I7e4827b3428b48c67060789a528586a8907ca3db
Reviewed-on: https://go-review.googlesource.com/c/go/+/221418
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
type sequencer struct {
mu sync.Mutex
id uint
- wait map[uint]chan uint
+ wait map[uint]chan struct{}
}
// Start waits until it is time for the event numbered id to begin.
s.mu.Unlock()
return
}
- c := make(chan uint)
+ c := make(chan struct{})
if s.wait == nil {
- s.wait = make(map[uint]chan uint)
+ s.wait = make(map[uint]chan struct{})
}
s.wait[id] = c
s.mu.Unlock()
id++
s.id = id
if s.wait == nil {
- s.wait = make(map[uint]chan uint)
+ s.wait = make(map[uint]chan struct{})
}
c, ok := s.wait[id]
if ok {
}
s.mu.Unlock()
if ok {
- c <- 1
+ close(c)
}
}