projects
/
arvados.git
/ blob
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Merge branch '20831-user-table-locks' refs #20831
[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
}