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

Function ExampleListQueue

list_queue_test.go:48–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46}
47
48func ExampleListQueue() {
49 q := NewListQueue(10)
50 q.Run()
51
52 var count int64
53 for i := 0; i < 10; i++ {
54 job := NewJob("foo", func(v interface{}) {
55 atomic.AddInt64(&count, 1)
56 })
57 q.Push(job)
58 }
59
60 q.Terminate()
61 fmt.Println(count)
62 // output: 10
63}
64
65func BenchmarkListQueue(b *testing.B) {
66 q := NewListQueue(100)

Callers

nothing calls this directly

Calls 5

RunMethod · 0.95
PushMethod · 0.95
TerminateMethod · 0.95
NewListQueueFunction · 0.85
NewJobFunction · 0.85

Tested by

no test coverage detected