
Context with wait support in Go - captplanet
https://github.com/zaininfo/context-wait
======
mgsouth
There's a race condition in Done() between ctx.Value() and close(); two
goroutines simultaneously calling Done() can both see Value() ok, then second
one calling close() will panic.

Mixing multiple concurrency coordinators (in this case a context and a
channel) is tricky, and Go adds little gotchas to the mix. You need a mutex to
make all operations atomic across both the context and channel.

~~~
captplanet
Good spot!

