// Close cleans up the resources used by the Multiplexer
1068
func (mux *Multiplexer) Close() {
	safeclose.Close(
		mux.Consumer,
		mux.hashSyncProducer,
		mux.hashAsyncProducer,
		mux.manSyncProducer,
		mux.manAsyncProducer)
}
463278
func (c *BaseConn) Close() error {
	c.sMutex.Lock()
	defer c.sMutex.Unlock()

	// flush buffer
	err1 := c.stream.Flush()

	// close carrier
	err2 := c.carrier.Close()

	// handle errors
	if err1 != nil {
		return err1
	} else if err2 != nil {
		return err2
	}

	return nil
}
620392
func (res *Resource) Close() {
	res.stmu.Lock()
	defer res.stmu.Unlock()

	res.chmu.Lock()
	if res.ch != nil {
		close(res.ch) // signal any references.
		res.ch = nil  // stop future Acquires
	}
	res.chmu.Unlock()

	res.wg.Wait() // wait for any acquired references
}
1336819
func (r *rx) cleanup() {
	a, b := r.q.Bytes()
	syscall.Munmap(a)
	syscall.Munmap(b)

	syscall.Munmap(r.data)
	syscall.Munmap(r.sharedData)
	syscall.Close(r.eventFD)
}
999615
func (f *fileSystem) Close() error {
	if f.temporary {
		return os.RemoveAll(f.root)
	}
	return nil
}
942801
func (combiner *itrCombiner) Close() {
	for _, holder := range combiner.holders {
		holder.itr.Close()
	}
}
238281
func (r *RemoveDirCloser) Close() error {
	return trace.ConvertSystemError(os.RemoveAll(r.Path))
}
571965
func (c *Pipeline) Close() error {
	c.mu.Lock()
	c.discard()
	c.closed = true
	c.mu.Unlock()
	return nil
}
1300897
func (u *ConcurrentUploader) Close() error {
	u.wg.Wait()
	close(u.waitc) // Sanity check that we don't do any more uploading.
	return u.err
}
301093
func (memif *Memif) Close() error {
	log.WithField("ifName", memif.IfName).Debug("Closing the memif interface")

	// Delete memif from C-libmemif.
	err := getMemifError(int(C.memif_delete(&memif.cHandle)))

	if err != nil {
		// Close memif-global interrupt channel.
		close(memif.intCh)
		// Close file descriptor stopQPollFd.
		C.close(C.int(memif.stopQPollFd))
	}

	context.lock.Lock()
	defer context.lock.Unlock()
	// Unregister the interface from the context.
	delete(context.memifs, memif.ifIndex)
	log.WithField("ifName", memif.IfName).Debug("memif interface was closed")

	return err
}
283374
func (m *qryconn) Close() error {
	defer m.source.mu.Unlock()
	delete(m.source.qryconns, m.tbl.Name)
	if m.rows != nil {
		if err := m.rows.Close(); err != nil {
			return err
		}
	}
	return nil
}
283381
func (m *MultiLog) Close() error {
	var errors []error
	for _, log := range m.loggers {
		errors = append(errors, log.Close())
	}
	return trace.NewAggregate(errors...)
}
767349
func (r *FilteredConn) Close() error {
	select {
	case <-r.closed:
		return errClosed
	default:
	}
	close(r.closed)
	r.source.removeConn(r)
	return nil
}
574202
func (a MultiStatsClient) Close() error {
	for _, c := range a {
		err := c.Close()
		if err != nil {
			return err
		}
	}
	return nil
}
409576
func (db *Database) Close() error {
	db.mux.Lock()
	defer db.mux.Unlock()
	return db.pool.close()
}
493133
func (pool *connPool) Close() error {
	var errs []error
	for {
		c := pool.Get()
		if c == nil {
			return errors.NewMultiErr(errs)
		}
		// Fix the reusuedConnections stat being incremented by Get()
		atomic.AddInt64(&pool.stats.reusuedConnections, -1)
		errs = append(errs, c.Close())
	}
}
854184
func (e *MergeJoinExec) Close() error {
	e.memTracker.Detach()
	e.childrenResults = nil
	e.memTracker = nil

	return e.baseExecutor.Close()
}