Merge branch '21356-clean-imports'
[arvados.git] / sdk / go / arvados / throttle.go
1 package arvados
2
3 type throttle struct {
4         c chan struct{}
5 }
6
7 func newThrottle(n int) *throttle {
8         return &throttle{c: make(chan struct{}, n)}
9 }
10
11 func (t *throttle) Acquire() {
12         t.c <- struct{}{}
13 }
14
15 func (t *throttle) Release() {
16         <-t.c
17 }