// Close closes channel (once) to start broadcasting it's closed state
332411
func (b *CloseBroadcaster) Close() error {
	b.Do(func() {
		close(b.C)
	})
	return nil
}
839232
func (p *V2) Close() error {
	p.Lock()
	defer p.Unlock()

	for _, location := range p.locations {
		if err := location.Close(); err != nil {
			return err
		}
	}

	for _, group := range p.groups {
		if err := group.Close(); err != nil {
			return err
		}
	}

	for _, dev := range p.devices {
		if err := dev.Close(); err != nil {
			return err
		}
	}

	if err := p.broadcast.Close(); err != nil {
		return err
	}

	select {
	case <-p.quitChan:
		common.Log.Warnf(`protocol already closed`)
		return common.ErrClosed
	default:
		close(p.quitChan)
		p.wg.Wait()
		close(p.deviceQueue)
	}

	return p.SubscriptionProvider.Close()
}
595722
func (s *state) Close() error {
	if s.cancel != nil {
		s.cancel()
	}
	return nil
}
397018
func (r *readSubscribeToShardEventStream) Close() error {
	r.closeOnce.Do(r.safeClose)

	return r.Err()
}
1368784
func (_m *Transmitter) Close() <-chan struct{} {
	ret := _m.Called()

	var r0 <-chan struct{}
	if rf, ok := ret.Get(0).(func() <-chan struct{}); ok {
		r0 = rf()
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(<-chan struct{})
		}
	}

	return r0
}
158605
func (w *window) close() {
	w.L.Lock()
	w.closed = true
	w.Broadcast()
	w.L.Unlock()
}
1150376
func (cbs *connBufShim) Close() error {
	if cbs.listeners == nil {
		for _, ln := range cbs.listeners {
			ln.Close() // TODO: care about error? use a MultiError?
		}
		cbs.listeners = nil
	}
	return nil
}
789463
func (p *Plugin) Close() error {
	//TODO close error report channel

	p.mu.Lock()
	defer p.mu.Unlock()

	p.registrations = make(map[string]*registration)

	return nil
}
161711
func (m *Broadcaster) closeAll() {
	m.lock.Lock()
	defer m.lock.Unlock()
	for _, w := range m.watchers {
		close(w.result)
	}
	// Delete everything from the map, since presence/absence in the map is used
	// by stopWatching to avoid double-closing the channel.
	m.watchers = map[int64]*broadcasterWatcher{}
}
89513
func (pr *pipeRelay) close() {
	pr.once.Do(func() {
		pr.io.Close()
		pr.ps.Close()
	})
}
1246208
func (s *server) Close() (err error) {
	s.closeOnce.Do(
		func() {
			err = s.close()
			s.closeSignal <- 1
			<-s.closedSignal
		})
	return
}
906000
func (self *Transcoder) Close() (err error) {
	for _, stream := range self.streams {
		if stream.aenc != nil {
			stream.aenc.Close()
			stream.aenc = nil
		}
		if stream.adec != nil {
			stream.adec.Close()
			stream.adec = nil
		}
	}
	self.streams = nil
	return
}
412385
func (s *Server) Close() error {
	s.Lock()
	defer s.Unlock()

	// If no listener is set, the server is in tunnel mode which means
	// closeFunc has to be manually called.
	if s.listener == nil {
		s.closeFunc()
		return nil
	}

	// listener already closed, nothing to do
	if s.listenerClosed {
		return nil
	}

	s.listenerClosed = true
	if s.listener != nil {
		err := s.listener.Close()
		return err
	}
	return nil
}
1279301
func (w *Webcam) Close() error {
	if w.streaming {
		w.StopStreaming()
	}

	err := unix.Close(int(w.fd))

	return err
}
825659
func (socket *fakeSocket) Close() error {
	socket.closeOnce.Do(func() {
		// broadcast that listener has closed to all listening parties
		close(socket.closed)
	})
	return nil
}
1196544
func (reg *WatchDataReg) Close() error {
	reg.adapter.access.Lock()
	defer reg.adapter.access.Unlock()

	for _, sub := range reg.adapter.subscriptions {
		// subscription should have also change channel, otherwise it is not registered
		// for change events
		if sub.ChangeChan != nil && sub.CloseChan != nil {
			// close the channel with all goroutines under subscription
			safeclose.Close(sub.CloseChan)
		}
	}

	delete(reg.adapter.subscriptions, reg.ResyncName)

	return nil
}
1023563
func (s *serialWriteCloser) Close() error {
	s.mu.Lock()
	defer s.mu.Unlock()
	return s.wc.Close()
}