// DecSendChanRefCount decrements SendChanRefCount
// It returns true if the RefCount has reached 0
509210
func (n *Graph) decSendChanRefCount(c reflect.Value) bool {
	n.sendChanMutex.Lock()
	defer n.sendChanMutex.Unlock()

	ptr := c.Pointer()
	cnt := n.sendChanRefCount[ptr]
	if cnt == 0 {
		return true //yes you may try to close a nonexistant channel, see what happens...
	}
	cnt--
	n.sendChanRefCount[ptr] = cnt
	return cnt == 0
}
578956
func (ns nsRefcounts_) JustRemoveOp(collName, key string, count int) txn.Op {
	op := txn.Op{
		C:      collName,
		Id:     key,
		Remove: true,
	}
	if count >= 0 {
		op.Assert = bson.D{{"refcount", count}}
	}
	return op
}
115507
func DecryptRequest(client io.Writer, r *http.Request, bucket, object string, metadata map[string]string) (io.WriteCloser, error) {
	return DecryptRequestWithSequenceNumber(client, r, bucket, object, 0, metadata)
}
792613
func (c Chain) HandlerFC(xhf HandlerFuncC) http.Handler {
	ctx := context.Background()
	return c.HandlerCtx(ctx, HandlerFuncC(xhf))
}
80357
func (c *RefCount) DecReads() {
	tracebackEvent(c, c.NumRef(), decReadsEvent)
	n := atomic.AddInt32(&c.reads, -1)

	if ref := c.NumRef(); ref < 1 {
		err := fmt.Errorf("read finish after free: reads=%d, ref=%d", n, ref)
		panicRef(c, err)
	}
}
948808
func (r *referencedNetworkEndpoint) decRef() {
	if atomic.AddInt32(&r.refs, -1) == 0 {
		r.nic.removeEndpoint(r)
	}
}
668650
func sendSSF(client *trace.Client, span *ssf.SSFSpan) error {
	done := make(chan error)
	err := trace.Record(client, span, done)
	if err != nil {
		return err
	}
	return <-done
}
613651
func (f *sendReceiveFolder) deleteDir(file protocol.FileInfo, dbUpdateChan chan<- dbUpdateJob, scanChan chan<- string) {
	// Used in the defer closure below, updated by the function body. Take
	// care not declare another err.
	var err error

	events.Default.Log(events.ItemStarted, map[string]string{
		"folder": f.folderID,
		"item":   file.Name,
		"type":   "dir",
		"action": "delete",
	})

	defer func() {
		events.Default.Log(events.ItemFinished, map[string]interface{}{
			"folder": f.folderID,
			"item":   file.Name,
			"error":  events.Error(err),
			"type":   "dir",
			"action": "delete",
		})
	}()

	if err = f.deleteDirOnDisk(file.Name, scanChan); err != nil {
		f.newPullError(file.Name, errors.Wrap(err, "delete dir"))
		return
	}

	dbUpdateChan <- dbUpdateJob{file, dbUpdateDeleteDir}
}
244509
func (ar AggregatedSendResult) AckCount() int {
	c := 0
	for _, ack := range ar {
		if ack.error == nil {
			c++
		}
	}
	return c
}
567299
func (s *GetBatchPredictionOutput) SetInvalidRecordCount(v int64) *GetBatchPredictionOutput {
	s.InvalidRecordCount = &v
	return s
}
646419
func (c *RefCount) IncRef() {
	n := atomic.AddInt32(&c.ref, 1)
	tracebackEvent(c, int(n), incRefEvent)
}
789264
func WithRefCount(d ctx.Doner) (ctx.C, *RefCtr) {
	ch, cancel := ctx.WithCancel(d)
	return ch, &RefCtr{cancel: cancel}
}
453488
func NewRefCounter(c Checker) *RefCounter {
	return &RefCounter{
		checker: c,
		counts:  make(map[string]*minfo),
	}
}
38884
func (t *Txn) trackChannelsAndCount(n *Node) int {
	// Count only leaf nodes
	leaves := 0
	if n.leaf != nil {
		leaves = 1
	}
	// Mark this node as being mutated.
	if t.trackMutate {
		t.trackChannel(n.mutateCh)
	}

	// Mark its leaf as being mutated, if appropriate.
	if t.trackMutate && n.leaf != nil {
		t.trackChannel(n.leaf.mutateCh)
	}

	// Recurse on the children
	for _, e := range n.edges {
		leaves += t.trackChannelsAndCount(e.node)
	}
	return leaves
}
478942
func (r *FileRef) FetchRefCount() int {
	if r == nil {
		return 0
	}

	r.m.Lock()
	ref := r.refs
	r.m.Unlock()

	return ref
}
1257385
func (obj *Doc) ForwardCount(ctx context.Context) (int, error) {
	result := &struct {
		Return int	`json:"qReturn"`
	} {}
	err := obj.rpc(ctx, "ForwardCount", result)
	return result.Return, err 
}
728783
func countApplicationOffersRefOp(mb modelBackend, appName string) (txn.Op, int, error) {
	refcounts, closer := mb.db().GetCollection(refcountsC)
	defer closer()
	key := applicationOffersRefCountKey(appName)
	return nsRefcounts.CurrentOp(refcounts, key)
}