On Thursday, January 26, 2017 at 6:29:54 PM UTC+8, dja...@gmail.com wrote:
>
>
>
> On Wednesday, January 25, 2017 at 3:14:27 PM UTC+2, T L wrote:
>>
>> sometimes, I do want one case on a select block get selected even if 
>> there are multiple unblocked cases.
>> For example, I don't want the dataCh case is selected if the stopCh and 
>> the timer channel are unblocked:
>>
>> select {
>> case <- stopCh:
>>     return
>> case value := <-dataCh:
>> }
>>
>> select {
>> case <- time.After(time.Second):
>>     return
>> case dataCh <- value:
>> }
>>
>> Is there a solution to satisfy my need currently?
>>
>
>
> Hi,
> multiple priority with only 2 nested selects: 
> https://play.golang.org/p/ViI54yGyIm
>
> Djadala
>
>
The intention of priority cases is just to reduce the select block usages 
(from several to one) at some special situations, 
instead of to control/adjust the selection possibilities of select-cases. 
Fewer select-block usages means more efficient code.




 

-- 
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