On Sun, Jul 10, 2016 at 1:03 PM,  <bigdr...@gmail.com> wrote:
> I came up with piece of code to use runtime.Gosched for batching multiple
> requests  "auto-magically" from the client side.
>
> https://play.golang.org/p/QK1wbtgVLf
>
> It works and it is actually very useful for many scenarios, but I wonder if
> this is a good/bad way of doing stuff like this, or is there a better/more
> proper way to do it.
>
> (I know the actual scheduling behavior is not defined, but I don't need the
> request to be strictly batched, just some degree of batching better than
> none.)

Your code looks pretty racy to me.  You should run it under the race
detector and fix any problems you discover (see
https://blog.golang.org/race-detector).  If you do that I think the
calls to runtime.Gosched will be pointless.

Ian

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