Files
openlan/pkg/libol/wait.go
2022-07-29 23:38:54 +08:00

20 lines
227 B
Go
Executable File

package libol
type WaitOne struct {
done chan bool
}
func NewWaitOne(n int) *WaitOne {
return &WaitOne{
done: make(chan bool, n),
}
}
func (w *WaitOne) Done() {
w.done <- true
}
func (w *WaitOne) Wait() {
<-w.done
}