3 ms·
Even in that case, wouldn't the main loop block for a short time but then unblock after the goroutine returns (and the defer function is executed)? I thought t
by xmprt 6y ago
Even in that case, wouldn't the main loop block for a short time but then unblock after the goroutine returns (and the defer function is executed)?
I thought the whole point of limitCh is to support the case where len(pss) > concurrencyProcesses but in this case you're telling me that it's breaking things?
- ben0x539 6y agoYes, that's the whole point, but it's completely broken. I've certainly made the same mistake. :D
- jeffbee 6y agoThe inner goroutine cannot return because it blocks at found<-P, because found is not buffered and there is no reader. This would work if the consumer was started in a goroutine first.
- xmprt 6y agoThanks. The part about starting the consumer in a goroutine actually made more sense as a solution than either of the given solutions. I guess I completely forgot how channels work and didn't realize that until there's a reader, the channel will block (which makes perfect sense in hindsight).