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

Function NewListQueueWithMaxLen

list_queue.go:17–27  ·  view source on GitHub ↗

NewListQueueWithMaxLen create a list queue that specifies the number of worker threads and the maximum number of elements

(maxThread, maxLen int)

Source from the content-addressed store, hash-verified

15// NewListQueueWithMaxLen create a list queue that specifies the number of worker threads
16// and the maximum number of elements
17func NewListQueueWithMaxLen(maxThread, maxLen int) *ListQueue {
18 return &ListQueue{
19 maxLen: maxLen,
20 maxWorker: maxThread,
21 workers: make([]*worker, maxThread),
22 workerPool: make(chan chan Jober, maxThread),
23 list: list.New(),
24 lock: new(sync.RWMutex),
25 wg: new(sync.WaitGroup),
26 }
27}
28
29// ListQueue a list task queue for mitigating server pressure in high concurrency situations
30// and improving task processing

Callers 1

NewListQueueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected