* lose the default case in your for loop. You want that select statment to block until one of the channels is ready, otherwise you have a busy loop. Your playground code actually returns "process took too long" because of that.
* remove the close(deltaChan) from the counter close, if you have a concurrent call to Add() with close it will cause a panic.
* for add & get value, use a select statement and include done, otherwise they will block indef. if they are called after Close(). I would call close(done) instead of sending on done so that it broadcasts as well.
And yes, if you want Get() to include your call to Add() after Add returns, then it would have to be an unbuffered channel.
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 firstname.lastname@example.org.
For more options, visit https://groups.google.com/d/optout.