// Nonblocking push. If the Evict callback is not set returns the
// evicted item (if any), otherwise nil.
771468
func (b *CircularBuffer) NBPush(v interface{}) interface{} {
	var evictv interface{}
	b.lock.Lock()

	if b.buffer[b.pos] != nil {
		panic("not nil")
	}

	b.buffer[b.pos] = v
	b.pos = (b.pos + 1) % b.size
	if b.pos == b.start {
		// Remove old item from the bottom of the stack to
		// free the space for the new one. This doesn't change
		// the length of the stack, so no need to touch avail.
		evictv = b.buffer[b.start]
		b.buffer[b.start] = nil
		b.start = (b.start + 1) % b.size
	} else {
		select {
		case b.avail <- true:
		default:
			panic("Sending to avail channel must never block")
		}
	}
	b.lock.Unlock()
	if evictv != nil && b.Evict != nil {
		// Outside the lock. User callback may in want to add
		// an item to the stack.
		b.Evict(evictv)
		return nil
	}
	return evictv
}
261145
func (l *ItemList) MoveAfter(e, mark *ItemElement) {
	if e.list != l || e == mark || mark.list != l {
		return
	}
	l.insert(l.remove(e), mark)
}
1052711
func (m *MovingMedian) Push(v float64) {
	if len(m.queue) == 1 {
		m.queue[0].f = v
		return
	}

	itemPtr := &m.queue[m.queueIndex]
	m.queueIndex++
	if m.queueIndex >= len(m.queue) {
		m.queueIndex = 0
	}

	if m.nitems == len(m.queue) {
		minAbove := m.minHeap.itemHeap[0].f
		maxBelow := m.maxHeap.itemHeap[0].f
		itemPtr.f = v
		if itemPtr.heapIndex < m.minHeap.Len() && itemPtr == m.minHeap.itemHeap[itemPtr.heapIndex] {
			if v >= maxBelow {
				heap.Fix(&m.minHeap, itemPtr.heapIndex)
				return
			}

			rotate(&m.maxHeap, &m.minHeap, m.maxHeap.itemHeap, m.minHeap.itemHeap, itemPtr)
			return
		}

		if v <= minAbove {
			heap.Fix(&m.maxHeap, itemPtr.heapIndex)
			return
		}

		rotate(&m.minHeap, &m.maxHeap, m.minHeap.itemHeap, m.maxHeap.itemHeap, itemPtr)
		return
	}

	m.nitems++
	itemPtr.f = v
	if m.minHeap.Len() == 0 || v > m.minHeap.itemHeap[0].f {
		heap.Push(&m.minHeap, itemPtr)
		rebalance(&m.minHeap, &m.maxHeap)
	} else {
		heap.Push(&m.maxHeap, itemPtr)
		rebalance(&m.maxHeap, &m.minHeap)
	}
}
1367511
func Push(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "push", Listener: listener}
}
786935
func (f *BackoffCloneFunc) PushReturn(r0 backoff.Backoff) {
	f.PushHook(func() backoff.Backoff {
		return r0
	})
}
924851
func (p *DefaultEvictionPolicy) Evict(config *EvictionConfig, underTest *PooledObject, idleCount int) bool {
	idleTime := underTest.GetIdleTime()

	if (config.IdleSoftEvictTime < idleTime &&
		config.MinIdle < idleCount) ||
		config.IdleEvictTime < idleTime {
		return true
	}
	return false
}
278439
func (combiner *itrCombiner) moveItrAndRemoveIfExhausted(i int) (removed bool, err error) {
	holder := combiner.holders[i]
	exhausted, err := holder.moveToNext()
	if err != nil {
		return false, err
	}
	if exhausted {
		combiner.holders[i].itr.Close()
		combiner.holders = append(combiner.holders[:i], combiner.holders[i+1:]...)

	}
	return exhausted, nil
}
1160873
func (pq *GetUtxoRequestPQ) Push(x interface{}) {
	item := x.(*GetUtxoRequest)
	*pq = append(*pq, item)
}
1140695
func (s *Selection) NotFunction(f func(int, *Selection) bool) *Selection {
	return pushStack(s, winnowFunction(s, f, false))
}
1012412
func (p *Pusher) Push(ctx context.Context) error {
	if p.PushFormat == "" {
		p.PushFormat = expfmt.FmtText
	}

	resps := make(chan (error))
	go func() {
		resps <- p.push(ctx)
	}()

	select {
	case err := <-resps:
		return err
	case <-ctx.Done():
		return ctx.Err()
	}
}
754749
func (l *PacketIntervalList) PushBack(v PacketInterval) *PacketIntervalElement {
	l.lazyInit()
	return l.insertValue(v, l.root.prev)
}
1147016
func (pq *BlockPriorityQueue) Push(blockData interface{}) {
	data, ok := blockData.(*cachedBlockData)
	if !ok || data == nil {
		fmt.Printf("Failed to push a cachedBlockData: %v", data)
		return
	}

	b := newCachedBlock(data.blockSummary, data.stakeInfo)
	b.Access()
	b.heapIdx = len(pq.bh)

	pq.updateMinMax(b.height)
	pq.bh = append(pq.bh, b)
	pq.lastAccess = time.Unix(0, b.accessTime)
}
705873
func (i *IndexedGCAllocPQ) Push(allocID string, ar AllocRunner) bool {
	i.pqLock.Lock()
	defer i.pqLock.Unlock()

	if _, ok := i.index[allocID]; ok {
		// No work to do
		return false
	}
	gcAlloc := &GCAlloc{
		timeStamp:   time.Now(),
		allocID:     allocID,
		allocRunner: ar,
	}
	i.index[allocID] = gcAlloc
	heap.Push(&i.heap, gcAlloc)
	return true
}
975091
func (lru *LRUCache) Evictions() int64 {
	lru.mu.Lock()
	defer lru.mu.Unlock()
	return lru.evictions
}
180750
func (q *Queue) Push(object interface{}) error {
	q.Lock()
	defer q.Unlock()

	if q.maxLen == 0 || q.len() < q.maxLen {
		q.queue = append(q.queue, object)
		return nil
	}

	// q.maxLen > 0 && q.len() == q.maxLen

	switch q.mode {
	case modeNormal:
		return ErrQueueOverflowed
	case modeDrop:
		if _, err := q.pop(); err != nil {
			return ErrFailedToDrop(err)
		}
		q.queue = append(q.queue, object)
		return nil
	}
	return nil
}
697856
func (h *nodesByDistance) push(n *node, maxElems int) {
	ix := sort.Search(len(h.entries), func(i int) bool {
		return enode.DistCmp(h.target, h.entries[i].ID(), n.ID()) > 0
	})
	if len(h.entries) < maxElems {
		h.entries = append(h.entries, n)
	}
	if ix == len(h.entries) {
		// farther away than all nodes we already have.
		// if there was room for it, the node is now the last element.
	} else {
		// slide existing entries down to make room
		// this will overwrite the entry we just appended.
		copy(h.entries[ix+1:], h.entries[ix:])
		h.entries[ix] = n
	}
}
268603
func (rww *ResponseWriterWrapper) Push(target string, opts *http.PushOptions) error {
	if pusher, hasPusher := rww.ResponseWriter.(http.Pusher); hasPusher {
		return pusher.Push(target, opts)
	}

	return NonPusherError{Underlying: rww.ResponseWriter}
}