Hello,
I had the basic code for my little channel "scatter"/dispatcher up and running (it is attached at end of email, in case you are interested to have a look and give me some suggestions:). we can plugin diff dispatching algorithms to the scatter, such as broadcast, roundrobin or random. Now i want to add some flow control (to avoid one slow receiver block everybody).
Do Go's channels support timed send/recv? I didnot see it in the spec. If i need to set it up from existing features, i am thinking about using a timer to generate timeout event to a channel (chan_timeout), then use a "select" to wrap up chan_timeout and the target chan send/recv operation, such as:
select {
case v := <- chan_target:
do_something_with_v;
case <- chan_timeout:
handle_timeout;
}
Is this correct way?
How should i create a timer in Go? search the "pkg" page, did not see it.
Thanks
Yigong