MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / SetThreads

Method SetThreads

internal/utils/fs/limiter.go:42–56  ·  view source on GitHub ↗
(newThreads int)

Source from the content-addressed store, hash-verified

40}
41
42func (this *Limiter) SetThreads(newThreads int) {
43 if newThreads <= 0 {
44 newThreads = this.countDefault
45 }
46
47 if newThreads != this.count {
48 var threadsChan = make(chan struct{}, newThreads)
49 for i := 0; i < newThreads; i++ {
50 threadsChan <- struct{}{}
51 }
52
53 this.threads = threadsChan
54 this.count = newThreads
55 }
56}
57
58func (this *Limiter) Ack() {
59 <-this.threads

Callers 2

TestLimiter_SetThreadsFunction · 0.80
onReloadMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestLimiter_SetThreadsFunction · 0.64