MCPcopy Index your code
hub / github.com/eapache/queue / Remove

Method Remove

queue.go:88–102  ·  view source on GitHub ↗

Remove removes and returns the element from the front of the queue. If the queue is empty, the call will panic.

()

Source from the content-addressed store, hash-verified

86// Remove removes and returns the element from the front of the queue. If the
87// queue is empty, the call will panic.
88func (q *Queue) Remove() interface{} {
89 if q.count <= 0 {
90 panic("queue: Remove() called on empty queue")
91 }
92 ret := q.buf[q.head]
93 q.buf[q.head] = nil
94 // bitwise modulus
95 q.head = (q.head + 1) & (len(q.buf) - 1)
96 q.count--
97 // Resize down if buffer 1/4 full.
98 if len(q.buf) > minQueueLen && (q.count<<2) == len(q.buf) {
99 q.resize()
100 }
101 return ret
102}

Callers 7

TestQueueSimpleFunction · 0.80
TestQueueWrappingFunction · 0.80
TestQueueLengthFunction · 0.80
BenchmarkQueueSerialFunction · 0.80
BenchmarkQueueTickTockFunction · 0.80

Calls 1

resizeMethod · 0.95

Tested by 7

TestQueueSimpleFunction · 0.64
TestQueueWrappingFunction · 0.64
TestQueueLengthFunction · 0.64
BenchmarkQueueSerialFunction · 0.64
BenchmarkQueueTickTockFunction · 0.64