github.com/puellanivis/breton@v0.2.16/lib/mapreduce/execchain.go (about) 1 package mapreduce 2 3 type execChain struct { 4 ch chan struct{} 5 ordered bool 6 } 7 8 func newExecChain(ordered bool) *execChain { 9 ch := make(chan struct{}) 10 close(ch) 11 12 return &execChain{ 13 ch: ch, 14 ordered: ordered, 15 } 16 } 17 18 func (c *execChain) next() (ready <-chan struct{}, next chan struct{}) { 19 ready = c.ch 20 21 if c.ordered { 22 next = make(chan struct{}) 23 c.ch = next 24 } 25 26 return ready, next 27 }