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

Method Push

list_queue.go:82–100  ·  view source on GitHub ↗

Push put the executable task into the queue

(job Jober)

Source from the content-addressed store, hash-verified

80
81// Push put the executable task into the queue
82func (q *ListQueue) Push(job Jober) {
83 if atomic.LoadUint32(&q.running) != 1 {
84 return
85 }
86
87 if q.maxLen > 0 {
88 q.lock.RLock()
89 if q.list.Len() > q.maxLen {
90 q.lock.RUnlock()
91 return
92 }
93 q.lock.RUnlock()
94 }
95
96 q.wg.Add(1)
97 q.lock.Lock()
98 q.list.PushBack(job)
99 q.lock.Unlock()
100}
101
102// Terminate terminate the queue to receive the task and release the resource
103func (q *ListQueue) Terminate() {

Callers 3

TestListQueueFunction · 0.95
ExampleListQueueFunction · 0.95
BenchmarkListQueueFunction · 0.95

Calls

no outgoing calls

Tested by 3

TestListQueueFunction · 0.76
ExampleListQueueFunction · 0.76
BenchmarkListQueueFunction · 0.76