()
| 99 | } |
| 100 | |
| 101 | func (q *Queue) pop() (interface{}, bool) { |
| 102 | if q.head == nil { |
| 103 | return nil, false |
| 104 | } |
| 105 | |
| 106 | n := q.head |
| 107 | data := n.data |
| 108 | q.head = n.next |
| 109 | if q.head == nil { |
| 110 | q.end = nil |
| 111 | } |
| 112 | q.c-- |
| 113 | q.node_pool.Put(n) |
| 114 | return data, true |
| 115 | } |
| 116 | |
| 117 | func (q *Queue) count() int { |
| 118 | return q.c |