Hello,

Anyone for a round of code golf?

I'm working on a piece of code for a streaming gRPC server and have found 
myself in the position that I need to wait for a notification event (in 
this case that a cache has been updated and I need to stream the results to 
the client) or a context.Done event. There may be multiple gRPC clients, 
and they may come and go without warning. Thus I'm in need of a sync.Cond 
type that works with select. 

I've coded this up, which appears to do the job

https://play.golang.org/p/pMZHwA1AD-

But I'm wondering if others have found themselves in the same position, and 
if so, what were your solutions? Am I missing something, will my cond loose 
notifications, or can it be simplified?

Thanks

Dave

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to