first result in googling "golang timeout"
select {
case <-ch:
// a read from ch has occurred
case <-timeout:
// the read from ch has timed out
}
but this code is a big trap of goroutine leaking. when read occurred first
the timeout goroutine will leak, and vice versa. I write some code which
reference this artcle, and found and fixed this bug a long time after that.
It would help lots of new comers if this artcle also include code to avoid
goroutine leak.
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/b0c132a0-13e2-4174-bece-7ee91a6120a0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.