// Fill sets value for future, if it were not already fullfilled
// Returns error, if it were already set to future.
484977
func (f *Selectable) Fill(v interface{}, e error) error {
	f.m.Lock()
	if f.filled == 0 {
		f.val = v
		f.err = e
		atomic.StoreUint32(&f.filled, 1)
		w := f.wait
		f.wait = closed
		if w != nil {
			close(w)
		}
	}
	f.m.Unlock()
	return f.err
}
75440
func (d *compressor) fillBlock(b []byte) int {
	n := copy(d.window[d.windowEnd:], b)
	d.windowEnd += n
	return n
}
519821
func (w *PrefixSuffixSaver) fill(dst *[]byte, p []byte) (pRemain []byte) {
	if remain := w.N - len(*dst); remain > 0 {
		add := minInt(len(p), remain)
		*dst = append(*dst, p[:add]...)
		p = p[add:]
	}
	return p
}
917338
func (m *HashMap) Fillrate() uintptr {
	data := m.mapData()
	count := atomic.LoadUintptr(&data.count)
	l := uintptr(len(data.index))
	return (count * 100) / l
}
1086050
func (s *stringSet) Add(vs ...string) {
	for _, v := range vs {
		s.values[v] = struct{}{}
	}
}
431838
func FillPlan(nodesInfo []types.NodeInfo, need, limit int) ([]types.NodeInfo, error) {
	log.Debugf("[FillPlan] need %d limit %d", need, limit)
	nodesInfoLength := len(nodesInfo)
	sort.Slice(nodesInfo, func(i, j int) bool { return nodesInfo[i].Count > nodesInfo[j].Count })
	p := sort.Search(nodesInfoLength, func(i int) bool { return nodesInfo[i].Count < need })
	if p == nodesInfoLength {
		return nil, types.ErrAlreadyFilled
	}
	nodesInfo = nodesInfo[p:]
	if limit > 0 && len(nodesInfo) > limit {
		nodesInfo = nodesInfo[:limit]
	}
	for i := range nodesInfo {
		diff := need - nodesInfo[i].Count
		if nodesInfo[i].Capacity < diff {
			return nil, types.NewDetailedErr(types.ErrInsufficientRes,
				fmt.Sprintf("node %s cannot alloc a fill node plan", nodesInfo[i].Name))
		}
		nodesInfo[i].Deploy = diff
		nodesInfo[i].Capacity -= diff
	}
	log.Debugf("[FillPlan] nodesInfo: %v", nodesInfo)
	return nodesInfo, nil
}
391285
func (rgc *RasterGraphicContext) Fill(paths ...*Path) {
	paths = append(paths, rgc.current.Path)
	rgc.fillRasterizer.UseNonZeroWinding = rgc.current.FillRule == FillRuleWinding

	flattener := Transformer{Tr: rgc.current.Tr, Flattener: FtLineBuilder{Adder: rgc.fillRasterizer}}
	for _, p := range paths {
		Flatten(p, flattener, rgc.current.Tr.GetScale())
	}

	rgc.paint(rgc.fillRasterizer, rgc.current.FillColor)
}
1230554
func (cr *Context) Fill() {
	C.cairo_fill(cr.Ptr)
	if err := cr.status(); err != nil {
		panic(err)
	}
}
124932
func (b *bitReader) fill() {
	if b.bitsRead < 32 {
		return
	}
	if b.off > 4 {
		v := b.in[b.off-4 : b.off]
		low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24)
		b.value = (b.value << 32) | uint64(low)
		b.bitsRead -= 32
		b.off -= 4
		return
	}
	for b.off > 0 {
		b.value = (b.value << 8) | uint64(b.in[b.off-1])
		b.bitsRead -= 8
		b.off--
	}
}
973734
func (b *Reader) fill() {
	// Slide existing data to beginning.
	if b.r > 0 {
		copy(b.buf, b.buf[b.r:b.w])
		b.w -= b.r
		b.r = 0
	}

	// Read new data.
	n, e := b.rd.Read(b.buf[b.w:])
	b.w += n
	if e != nil {
		b.err = e
	}
}
976068
func (l *logging) fill(cfg *yarpc.Config) {
	cfg.Logging.Levels.ApplicationError = (*zapcore.Level)(l.Levels.ApplicationError)
}
360984
func (p *Painter) FillRect(x, y, w, h int) {
	for j := 0; j < h; j++ {
		for i := 0; i < w; i++ {
			p.DrawRune(i+x, j+y, ' ')
		}
	}
}
559274
func (f *future) set(instance loader.PluginInstance, err error) {
	f.instance = instance
	f.err = err
	close(f.waitCh)
}
1106859
func (c *ReactionsGetCall) Full(full bool) *ReactionsGetCall {
	c.full = full
	return c
}
1034502
func (t *Tuple) Append(value interface{}) {
	t.Values = append(t.Values, value)
}
596935
func (config *BitriseDataModel) FillMissingDefaults() error {
	if err := config.App.FillMissingDefaults(); err != nil {
		return err
	}

	for title, workflow := range config.Workflows {
		if err := workflow.FillMissingDefaults(title); err != nil {
			return err
		}
	}

	return nil
}
1329441
func (pool *hostConnPool) fillingStopped(hadError bool) {
	if hadError {
		// wait for some time to avoid back-to-back filling
		// this provides some time between failed attempts
		// to fill the pool for the host to recover
		time.Sleep(time.Duration(rand.Int31n(100)+31) * time.Millisecond)
	}

	pool.mu.Lock()
	pool.filling = false
	pool.mu.Unlock()
}