// IsClosing returns true if the syncer has been asked to close.
961375
func (s *holderSyncer) IsClosing() bool {
	if s.Cluster.abortAntiEntropyQ() {
		return true
	}
	select {
	case <-s.Closing:
		return true
	default:
		return false
	}
}
632929
func (p *GncpPool) Close() error {
	if p.isClosed() == true {
		return errPoolIsClose
	}
	p.lock.Lock()
	defer p.lock.Unlock()
	p.closed = true
	close(p.conns)
	for conn := range p.conns {
		conn.Close()
	}
	return nil
}
994516
func IsWSClosedErr(err error) (closedErr bool) {
	// Must use strings.Contains to catch errors like "write tcp
	// 127.0.0.1:7777->127.0.0.1:39196: use of closed network connection".
	return err != nil && strings.Contains(err.Error(), ErrWsClosed)
}
126332
func (ai *Amqp) NotifyClose(c chan *amqp.Error) chan *amqp.Error {
	return ai.conn.NotifyClose(c)
}
458895
func (s *Subscriptions) IsClosed() bool {
	s.lock.RLock()
	defer s.lock.RUnlock()
	return s.closed
}
161200
func (c *ServerContext) AddCloser(closer io.Closer) {
	c.Lock()
	defer c.Unlock()
	c.closers = append(c.closers, closer)
}
502737
func (rw rwCloser) Close() error {
	err := rw.ReadCloser.Close()
	if err := rw.WriteCloser.Close(); err != nil {
		return err
	}
	return err
}
410739
func (iter *iteratorSingle) Close() error {
	if iter.closer != nil {
		iter.closer.Close()
		iter.closer = nil
	}

	return nil
}
758765
func (s *Session) OnClose(c func()) error {
	if !s.IsFrontend {
		return constants.ErrOnCloseBackend
	}
	s.OnCloseCallbacks = append(s.OnCloseCallbacks, c)
	return nil
}
1176491
func TryClose(r interface{}) error {
	if r, ok := r.(Closer); ok {
		return r.Close()
	}
	if r, ok := r.(SimpleCloser); ok {
		r.Close()
		return nil
	}
	return ErrNotCloseable
}
360265
func isErrClosing(err error) bool {
	if opErr, ok := err.(*net.OpError); ok {
		err = opErr.Err
	}
	return "use of closed network connection" == err.Error()
}
1219782
func (cc *ClosingControl) ensureOpen(failIfClosing bool) {
	assert2(!cc._closed && (!failIfClosing || !cc._closing), "this IndexWriter is closed")
}
1367583
func (e *EventListener) IsClosed() bool {
	e.closedMtx.RLock()
	defer e.closedMtx.RUnlock()
	return e.closed
}
1275213
func (l *Listener) closed() bool {
	l.lock.Lock()
	defer l.lock.Unlock()

	return l.isClosed
}
388966
func (c *closeHelper) Close(cl io.Closer) {
	if err := cl.Close(); c.err == nil {
		c.err = err
	}
}
1085134
func IsSessionClosed(err error) bool {
	switch err {
	case ErrSessionClosed, sockjs.ErrSessionNotOpen, websocket.ErrCloseSent:
		return true
	}
	if e, ok := err.(*ErrSession); ok && e.State > sockjs.SessionActive {
		return true
	}
	_, ok := err.(*websocket.CloseError)
	return ok
}
304235
func (c *Conn) GoClose() {
	c.closingLock.Lock()
	defer c.closingLock.Unlock()
	if c.closing {
		return
	}
	c.closing = true

	go c.Close()
}