libgit2/git2go — pull request #24 by carlosmn (2013-05-17 09:51:02+00:00)
Title: Allow aborting the pack writing operation

In case of an error in the writer, the packbuilder will stay around
waiting for someone to read from its channel. The state associated
with a packbuilder is non-trivial and it will keep a reference to the
object, so the GC won't be able to free it.

Change the callback so it knows to abort the writing operation when it
receives a message through the channel and the goroutine can end,
freeing its hold on the packbuilder.

---

As elegant as the solution with channels is, we should always have a way of telling the producer that we can't consume any more or we won't be webscale.