// dirtyNext makes iter.dirtyIt go and update valid status.
174215
func (iter *UnionIter) dirtyNext() error {
	err := iter.dirtyIt.Next()
	iter.dirtyValid = iter.dirtyIt.Valid()
	return err
}
608336
func (d *DirtyBlockCacheStandard) UpdateUnsyncedBytes(_ tlf.ID,
	newUnsyncedBytes int64, wasSyncing bool) {
	d.lock.Lock()
	defer d.lock.Unlock()
	if wasSyncing {
		d.syncBufBytes += newUnsyncedBytes
	} else {
		d.updateWaitBufLocked(newUnsyncedBytes)
	}
	if newUnsyncedBytes < 0 {
		d.signalDecreasedBytes()
	}
}
58728
func (w *Watch) WaitNext(ctx context.Context, lastRevision int64, notify chan<-int64) {
	for {
		w.rwl.RLock()
		if w.revision > lastRevision {
			w.rwl.RUnlock()
			break
		}
		cond := w.cond
		w.rwl.RUnlock()
		select{
		case <-cond:
		case <-ctx.Done():
			return
		}
	}
	// We accept larger revision, so do not need to use RLock
	select{
	case notify<-w.revision:
	case <-ctx.Done():
	}
}
903725
func (h *history) _baseNextPrev(c byte) (line []rune, err error) {
	if h.li.Len() <= 0 {
		return line, ErrEmptyHist
	}

	new := new(list.Element)
	if c == 'p' {
		new = h.mark.Prev()
	} else if c == 'n' {
		new = h.mark.Next()
	} else {
		panic("history._baseNextPrev: wrong character choice")
	}

	if new != nil {
		h.mark = new
	} else {
		return nil, ErrNilElement
	}

	return []rune(new.Value.(string)), nil
}
593773
func (df *DirtyFile) UpdateNotYetSyncingBytes(newBytes int64) {
	df.lock.Lock()
	defer df.lock.Unlock()
	df.notYetSyncingBytes += newBytes
	if df.notYetSyncingBytes < 0 {
		// It would be better if we didn't have this check, but it's
		// hard for folderBlockOps to account correctly when bytes in
		// a syncing block are overwritten, and then the write is
		// deferred (see KBFS-2157).
		df.notYetSyncingBytes = 0
	}
	df.dirtyBcache.UpdateUnsyncedBytes(df.Path.Tlf, newBytes, false)
}
808273
func (m MiddlewareFunc) ServeNext(next http.Handler) http.Handler {
	return m(next)
}
180751
func (e *CElement) SetNext(newNext *CElement) {
	e.mtx.Lock()

	oldNext := e.next
	e.next = newNext
	if oldNext != nil && newNext == nil {
		// See https://golang.org/pkg/sync/:
		//
		// If a WaitGroup is reused to wait for several independent sets of
		// events, new Add calls must happen after all previous Wait calls have
		// returned.
		e.nextWg = waitGroup1() // WaitGroups are difficult to re-use.
		e.nextWaitCh = make(chan struct{})
	}
	if oldNext == nil && newNext != nil {
		e.nextWg.Done()
		close(e.nextWaitCh)
	}
	e.mtx.Unlock()
}
837744
func (e *MergeJoinExec) fetchNextInnerRows() (err error) {
	e.innerRows, err = e.innerTable.rowsWithSameKey()
	if err != nil {
		return err
	}
	e.innerIter4Row = chunk.NewIterator4Slice(e.innerRows)
	e.innerIter4Row.Begin()
	return nil
}
693630
func (s *DeviceRegistryEnrichActivity) SetNext(v string) *DeviceRegistryEnrichActivity {
	s.Next = &v
	return s
}
180258
func (s *SelectAttributesActivity) SetNext(v string) *SelectAttributesActivity {
	s.Next = &v
	return s
}
1103625
func (re *Regexp) FindNextMatch(m *Match) (*Match, error) {
	if m == nil {
		return nil, nil
	}

	// If previous match was empty, advance by one before matching to prevent
	// infinite loop
	startAt := m.textpos
	if m.Length == 0 {
		if m.textpos == len(m.text) {
			return nil, nil
		}

		if re.RightToLeft() {
			startAt--
		} else {
			startAt++
		}
	}
	return re.run(false, startAt, m.text)
}
786740
func (m *metadataTracker) resetAll(dev protocol.DeviceID) {
	m.mut.Lock()
	m.dirty = true
	for i, c := range m.counts.Counts {
		if bytes.Equal(c.DeviceID, dev[:]) {
			m.counts.Counts[i] = Counts{
				DeviceID:   c.DeviceID,
				LocalFlags: c.LocalFlags,
			}
		}
	}
	m.mut.Unlock()
}
901027
func (s *session) RefreshTxnCtx(ctx context.Context) error {
	if err := s.doCommit(ctx); err != nil {
		return err
	}

	return s.NewTxn(ctx)
}
277347
func (t *NodeIterator) MoveNext() bool {
	n := t.query.Select(t)
	if n != nil {
		if !t.node.MoveTo(n) {
			t.node = n.Copy()
		}
		return true
	}
	return false
}
1188928
func (it *ValIterator) GetNext(outVal interface{}) (stop bool) {
	if m, ok := outVal.(map[string]interface{}); ok {
		ok = it.Delegate.ScanMap(m)
		return !ok //if not ok than stop
	}

	_, ptrs := structs.ListExportedFieldsPtrs(outVal, cqlExported)
	ok := it.Delegate.Scan(ptrs...)
	return !ok //if not ok than stop
}
494692
func (md *MDCacheStandard) PutNextMD(
	tlfID tlf.ID, rootSeqno keybase1.Seqno, nextKbfsRoot *kbfsmd.MerkleRoot,
	nextMerkleNodes [][]byte, nextRootSeqno keybase1.Seqno) error {
	key := mdcacheNextMDKey{tlfID, rootSeqno}
	val := mdcacheNextMDVal{nextKbfsRoot, nextMerkleNodes, nextRootSeqno}
	md.nextMDLRU.Add(key, val)
	return nil
}
812978
func (m *MaxAge) ServeNext(next http.Handler) http.Handler {
	if m.Filter == nil {
		// Filter nothing
		m.Filter = func(r *http.Request) bool { return false }
	}

	fn := func(w http.ResponseWriter, r *http.Request) {
		if m.Filter(r) {
			w.Header().Add("Cache-Control", fmt.Sprintf("max-age=%d, public, must-revalidate, proxy-revalidate", int(m.Duration.Seconds())))
		}
		next.ServeHTTP(w, r)
	}

	return http.HandlerFunc(fn)
}