MCPcopy Create free account
hub / github.com/LyricTian/queue / NewQueue

Function NewQueue

chan_queue.go:9–17  ·  view source on GitHub ↗

NewQueue create a queue that specifies the number of buffers and the number of worker threads

(maxCapacity, maxThread int)

Source from the content-addressed store, hash-verified

7
8// NewQueue create a queue that specifies the number of buffers and the number of worker threads
9func NewQueue(maxCapacity, maxThread int) *Queue {
10 return &Queue{
11 jobQueue: make(chan Jober, maxCapacity),
12 maxWorkers: maxThread,
13 workerPool: make(chan chan Jober, maxThread),
14 workers: make([]*worker, maxThread),
15 wg: new(sync.WaitGroup),
16 }
17}
18
19// Queue a task queue for mitigating server pressure in high concurrency situations
20// and improving task processing

Callers 5

TestQueueFunction · 0.85
TestSyncQueueFunction · 0.85
ExampleQueueFunction · 0.85
BenchmarkQueueFunction · 0.85
RunFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestQueueFunction · 0.68
TestSyncQueueFunction · 0.68
ExampleQueueFunction · 0.68
BenchmarkQueueFunction · 0.68