The following code, box red part to write an if ok or to write an if! Ok to run the result is the same, is this why, what is the other 29 exitChan values in the line of code, bosses give advice or comments, thank you
CodePudding user response:
ExitChan to indicate the main thread end waiting, put in true & lt; The data - exitChan was taken, ok=true, exit the loop
If! Ok and if ok certainly is not the same, you probably made a mistake
The standard method and exitChan should be chan struct {}, in order to reduce memory consumption
CodePudding user response:
<- exitChan when unable to remove the data block, don't need to have a dead circulation outside