Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Barrier ¶
type Barrier struct {
// contains filtered or unexported fields
}
Barrier for limited go-routines
Example ¶
b := NewBarrier(15) log.SetFlags(log.LstdFlags | log.Lmicroseconds) wg := &sync.WaitGroup{} for i := 0; i < 100; i++ { b.Advance() wg.Add(1) go func(i int) { defer wg.Done() defer b.Done() time.Sleep(time.Millisecond * 500) log.Printf("done %d", i) }(i) } wg.Done()
Output:
Click to show internal directories.
Click to hide internal directories.