mirror of
https://github.com/luscis/openlan.git
synced 2025-10-05 16:47:11 +08:00
20 lines
227 B
Go
Executable File
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
|
|
}
|