So, I was talking with a friend about channels and mutexs, and the use of 
mutexs instead of channels. While I'm not sure why you'd want to, I was 
given this <https://play.golang.org/p/LNoqtDjxDy> example and not an answer.

In the example, he declares two channels. Input and Output. Then, he has a 
function running a for select loop in a gorutine. The input object accepts 
a text of body(string) and an ID (int), to which it stores it in a map. 
Then, the output channel accepts a request id (int), and a chan string. 
When something is put on the output channel, he gets the body of text out 
of the map and writes it to the output object's return channel and then 
closes it. 

My question, is this a good practice? Why would one want to use channels in 
place of mutexs? Is this efficient? 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to