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

Method Terminate

chan_queue.go:53–66  ·  view source on GitHub ↗

Terminate terminate the queue to receive the task and release the resource

()

Source from the content-addressed store, hash-verified

51
52// Terminate terminate the queue to receive the task and release the resource
53func (q *Queue) Terminate() {
54 if atomic.LoadUint32(&q.running) != 1 {
55 return
56 }
57
58 atomic.StoreUint32(&q.running, 0)
59 q.wg.Wait()
60
61 close(q.jobQueue)
62 for i := 0; i < q.maxWorkers; i++ {
63 q.workers[i].Stop()
64 }
65 close(q.workerPool)
66}
67
68// Push put the executable task into the queue
69func (q *Queue) Push(job Jober) {

Callers 4

TestQueueFunction · 0.95
TestSyncQueueFunction · 0.95
ExampleQueueFunction · 0.95
BenchmarkQueueFunction · 0.95

Calls 2

StopMethod · 0.80
WaitMethod · 0.65

Tested by 4

TestQueueFunction · 0.76
TestSyncQueueFunction · 0.76
ExampleQueueFunction · 0.76
BenchmarkQueueFunction · 0.76