select {
case c <- true:
    method1()
default:
    // do something because channel is full
    // perhaps put in a for{} loop to retry after a pause
}

On Wednesday, January 4, 2017 at 1:26:07 PM UTC-7, Kritta wrote:
>
> For example,
>
> go func() {
>    c <- true //This is blocked cause c is full
>    method1()
> }
>
> Others goroutine include main has no reference to 'c', so there're no way 
> out for 'c'.
> Questions:
>
>    1. Will method1() be executed and when?
>    2. Will this gorountine released or still there forever?
>
>

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