On 29/01/15 09:50, Péter Szilágyi wrote:
It's a very fancy solution, but unfortunately it doesn't work, as it
encounters exactly the same problems as all previous suggestions: in Go,
all existing readers and writers are synchronous and blocking. Meaning,
that even if a reader or writer is buffered, the buffer is only
filled/flushed when it's empty/full. The issue with all solutions is
that you need to place the buffer in between the two threads, not
between a thread and the reader/writer endpoint. And this is what no
solution apart from my proposal solves (Jan's solution of course also
does it, just requires a bit more locking and gc).

However, given that it seems a bit hard to grasp the exact issue, I've
decided to put together a more formal proposal, with exact code snippets
simulating the issue and verification that the issue indeed does persist
in all above short/easy solutions:

$ go get github.com/karalabe/bufioprop/shootout
Excellent example code.

I've just read through your bufio.Copy code:

The error handling is potentially racy. You are writing the err
variable from two different go routines.

It is quite complicated - I have a feeling it could be simplified with
more buffers - I'll try to see if I can do better within your nice

Nick Craig-Wood <nick@craig-wood.com> -- http://www.craig-wood.com/nick

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 | 16 of 22 | next ›
Discussion Overview
groupgolang-nuts @
postedJan 28, '15 at 8:18a
activeJan 30, '15 at 1:02p



site design / logo © 2021 Grokbase