[Solved] What’s wrong with my golang code? [duplicate]


deQueue is looping infinitely on the fail case, which is blocking the CPU. Goroutines don’t yield while doing CPU work. GOMAXPROCS needs to be >= 2 to get CPU parallelism.

just for kicks, here’s a threadsafe, nonblocking queue implementation using higher-order channels: https://gist.github.com/3668150

solved What’s wrong with my golang code? [duplicate]