package main import ( "log" "sync" ) type IBarrier interface { // error for timeout if need Await() error } // once type ChanBarrier struct { waitCh chan struct{} sign chan struct{} } func NewChanBarrier(gos int)*ChanBarrier{ b := &ChanBarrier{ waitCh:make(chan struct{} ,gos-1), sign:make(chan struct{}), } for i:=0;i