I had case when I wanted to receive msg and and send message from inchan to
outchan in for-select. What I have did is following.
for {
select {
case msg = <-inchan:
case <-exitc:
exit = true
}
if exit {
break
}
select {
case outchan <- msg:
case <-exitc:
exit = true
}
if exit {
break
}
}
Any better way of doing it? *If language supports* then what I want can be
done as following, if inchan is ready to send and outchan ready to receive
then only it succeed.
for {
select {
case outchan <- inchan:
case <-exitc:
exit = true
}
if exit {
break
}
}
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.