I've often had similar thoughts. 

Getting started with Go, a barrier synchronizer 
that played nice with channels seems like a natural
idea.

But there's not one as far as I know.

Perhaps that's because it's not difficult to build one. Or
because it puts the cleanup onus on the garbage collector.

e.g. becasue you would construct such a barrier by replacing 
a well-known channel after each close. 

You just have to be careful to have only one writer around 
the changes to that channel.  

Or perhaps it is because sync.WaitGroup and sync.Cond (condition variables) 
exist. They
aren't select{}-friendly, but they usually do the job.

In any case, I wrote a little library that does this to 
demonstrate how one might do a select{} friendly barrier. 

It provides a selectable.Barrier:

https://github.com/glycerine/selectable

Enjoy,
Jason

-- 
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