// Put will return a resource to the pool. You MUST return every resource to the pool,
// even if it's closed. If a resource is closed, you should call Put(nil).
4303
func (rr *RoundRobin) Put(resource Resource) {
	rr.mu.Lock()
	defer rr.available.Signal()
	defer rr.mu.Unlock()

	if rr.size > int64(cap(rr.resources)) {
		if resource != nil {
			go resource.Close()
		}
		rr.size--
	} else if resource == nil {
		rr.size--
	} else {
		if len(rr.resources) == cap(rr.resources) {
			panic("unexpected")
		}
		rr.resources <- fifoWrapper{resource, time.Now()}
	}
}
1309737
func (bp *Pool) Put(obj interface{}) {
	finalize := true
	if bp.CanReturn == nil || bp.CanReturn(obj) {
		finalize = !bp.pool.Offer(obj)
	}

	if finalize && bp.Finalize != nil {
		bp.Finalize(obj)
	}
}
708984
func (p *intPool) put(is ...*big.Int) {
	if len(p.pool.data) > poolLimit {
		return
	}
	for _, i := range is {
		// verifyPool is a build flag. Pool verification makes sure the integrity
		// of the integer pool by comparing values to a default value.
		if verifyPool {
			i.Set(checkVal)
		}
		p.pool.push(i)
	}
}
1359278
func (s *SwiftBackend) Put(ctx context.Context, entry *physical.Entry) error {
	defer metrics.MeasureSince([]string{"swift", "put"}, time.Now())

	s.permitPool.Acquire()
	defer s.permitPool.Release()

	err := s.client.ObjectPutBytes(s.container, entry.Key, entry.Value, "")

	if err != nil {
		return err
	}

	return nil
}
698026
func (p *Pool) Put(x interface{}) {
	if x == nil {
		return
	}
	p.mu.Lock()
	if p.list == nil {
		if p.drainTicker == nil && p.DrainPeriod != 0 {
			p.drainTicker = time.NewTicker(p.DrainPeriod)
			go func() {
				for _ = range p.drainTicker.C {
					p.Drain()
				}
			}()
		}
	}
	p.list = append(p.list, x)
	p.mu.Unlock()
}
838744
func (pdb *protoBroker) Put(key string, value proto.Message, opts ...datasync.PutOption) error {
	return putProtoInternal(pdb.broker, pdb.serializer, key, value, opts...)
}
173942
func (bp *BufferPool) Put(buf []byte) {
	if len(buf) <= bp.maxBufSize {
		bp.mutex.Lock()
		if bp.pos < int64(bp.poolSize-1) {
			bp.pos++
			bp.pool[bp.pos] = buf
		}
		bp.mutex.Unlock()
	}
}
310738
func (p *pool) push(resp *resp) error {
	_, err := p.do(pushRequest, resp)
	return err
}
610564
func (p *Pool) Put(job func()) error {
	if atomic.LoadInt32(&p.state) != 1 {
		return ErrPoolShutdown
	}

	select {
	case p.jobs <- job:
		if p.busy >= p.current && p.current < p.Max {
			go p.short()
		}
		return nil
	default:
		return ErrPoolFull
	}
}
1104761
func (cp *Pool) Put(conn *DBConn) {
	p := cp.pool()
	if p == nil {
		panic(ErrConnPoolClosed)
	}
	if conn == nil {
		p.Put(nil)
	} else {
		p.Put(conn)
	}
}
1000525
func (p *Pool) Put(length uint32, val interface{}) {
	idx := prevPowerOfTwo(length)
	// fmt.Printf("Put(%d, -) idx(%d)\n", length, idx)
	sp := p.getPool(idx)
	sp.Put(val)
}
1182684
func (c *Collection) Put(i gtreap.Item) {
	c.assertNotReadOnly()

	// Lock around the entire Upsert operation to serialize Puts.
	priority := rand.Int()
	c.rootLock.Lock()
	c.root = c.root.Upsert(i, priority)
	c.rootLock.Unlock()
}
670050
func (m *CouchDBBackend) Put(ctx context.Context, entry *physical.Entry) error {
	m.permitPool.Acquire()
	defer m.permitPool.Release()

	return m.PutInternal(ctx, entry)
}
869323
func Put(url string, ro *RequestOptions) (*Response, error) {
	return DoRegularRequest("PUT", url, ro)
}
1182327
func (bp *BufferPool) Put(b *bytes.Buffer) {
	b.Reset()

	if cap(b.Bytes()) > bp.alloc {
		b = bytes.NewBuffer(make([]byte, 0, bp.alloc))
	}

	select {
	case bp.c <- b:
	default: // Discard the buffer if the pool is full.
	}
}
767689
func (tp *BytePool) Put(el []byte) {
	if cap(el) < 1 || cap(el) > tp.maxSize {
		return
	}
	el = el[:cap(el)]
	o := log2Floor(uint32(cap(el)))
	p := &tp.list_of_pools[o]
	p.mu.Lock()
	p.list = append(p.list, el)
	p.mu.Unlock()
}
843111
func (c *container) Put(name string, r io.Reader, size int64, metadata map[string]interface{}) (stow.Item, error) {
	mdPrepped, err := prepMetadata(metadata)
	if err != nil {
		return nil, errors.Wrap(err, "unable to create or update Item, preparing metadata")
	}

	_, err = c.client.ObjectPut(c.id, name, r, false, "", "", nil)
	if err != nil {
		return nil, errors.Wrap(err, "unable to create or update Item")
	}

	err = c.client.ObjectUpdate(c.id, name, mdPrepped)
	if err != nil {
		return nil, errors.Wrap(err, "unable to update Item metadata")
	}

	item := &item{
		id:        name,
		container: c,
		client:    c.client,
		size:      size,
		// not setting metadata here, the refined version isn't available
		// unless an explicit getItem() is done. Possible to write a func to facilitate
		// this.
	}
	return item, nil
}