pivotal-cf-experimental/garden — pull request #8 by glyn (2014-03-31 09:52:07+00:00)
Title: Avoid receive starvation

Although Go chooses between multiple select cases which are ready to
communicate, it does not guarantee fairness. So, on a busy system,
there is no guarantee that the WardenServer trackStopping method will
receive from s.setStopping if it can always send to s.stopping.

So check s.setStopping (without blocking) after each successful send
to s.stopping.

The fix is strictly necessary from a theoretical perspective, but extremely unlikely to be necessary in practice. The real value of the fix is to improve Go concurrency style.