On Tue, Apr 4, 2023 at 7:56 AM Skip Tavakkolian
<skip.tavakkol...@gmail.com> wrote:
> mux9p, Fazlul Shahriar's port of Russ' 9pserve (plan9port)
> https://github.com/fhs/mux9p/search?q=clientIO
>
> ...
>
>     select {
>     case v, ok := <- counts:
>         // collect samples
>     case reporting <- Stats{ stats }:
>     case <-timer:
>        // calculate stats from samples
>      case cmd, ok := <-commands:
>        // reset counters, restart worker, exit, etc.
>     }

I'd have to study mux9p for longer, but its select chooses between two
receives, so it could possibly collapse to a single heterogenous
channel. Indeed, both its channels are already heterogenous in some
sense. Both its processTx and processRx methods say "switch
m.tx.Type".

Your second suggestion, mixing both sends (on the reporting channel)
and receives, is interesting. Would it be possible to move the
`reporting <- Stats{ stats }` case inside the `case <-timer: //
calculate stats from samples` body, though?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOeFMNV5qW40W%3D%2Bb%2BfN%2BVrZA6z2HEMLeFvWJZQ1UmV9cs%3Dv6Pg%40mail.gmail.com.

Reply via email to