As I read it makes a quick-try to acquire a pre-allocated buffer, otherwise makes its own. Then it makes a quick-try to give the buffer it used back (to be used by another goroutine).
That is a very elegant use of channels to create an optimistic buffer. Enjoyed that read :)
https://code.google.com/p/go/source/detail?r=4b61f121966b
As I read it makes a quick-try to acquire a pre-allocated buffer, otherwise makes its own. Then it makes a quick-try to give the buffer it used back (to be used by another goroutine).
That is a very elegant use of channels to create an optimistic buffer. Enjoyed that read :)