On Monday, October 27, 2014 5:09:30 PM UTC+2, Ian Lance Taylor wrote:
On Sun, Oct 26, 2014 at 11:12 PM, Nick Patavalis
<nick.pa...@gmail.com <javascript:>> wrote:
On Monday, October 27, 2014 5:35:23 AM UTC+2, Ian Lance Taylor wrote:

I wouldn't worry about using select. Instead have a goroutine that
does blocking reads and writes the data to a channel. Then other
goroutines can handle the timeout using a Go select statement.
Yes, but when the timeout is detected you need to, somehow, notify the
"reading" goroutine (which will probably be blocked inside read(2)) to

Hmmm.... So what you mean is that, once an FD is opened, you start a
goroutine reading from it and writing data to a channel, and leave it there
running.... forever. Whenever you want to read from the FD you actually
read from the channel. Yes, it could work.

Eventually, you will, though, have to stop this goroutine (somehow) even if
it is when you no longer need the FD (i.e. when it's time to close it), and
again, you have to do it "carefully"---for the reasons described above.


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.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 28 | next ›
Discussion Overview
groupgolang-nuts @
postedOct 26, '14 at 9:10a
activeOct 27, '14 at 7:01p



site design / logo © 2022 Grokbase