//stop processing items and close
335219
func (this *BufferedWriter) Close() error {
	close(this.queue)
	<-this.done
	return nil
}
1102437
func (s *PrioritySlot) Stop() {
	s.mu.Lock()
	defer s.mu.Unlock()
	if s.cancel != nil {
		s.cancel()
		s.cancel = nil
		s.priority = 0
	}
}
669318
func (m *memoryMailBox) Stop() error {
	if !atomic.CompareAndSwapUint32(&m.stopped, 0, 1) {
		return nil
	}

	close(m.quit)

	m.wireCond.Signal()
	m.pktCond.Signal()

	return nil
}
1233639
func (c *client) Stop() {
	c.active = false
	close(c.quit)
	c.Close()
}
1308331
func (c *cacheWatcher) stop() {
	c.Lock()
	defer c.Unlock()
	if !c.stopped {
		c.stopped = true
		close(c.done)
		close(c.input)
	}
}
1338417
func (w *Producer) Stop() {
	w.guard.Lock()
	if !atomic.CompareAndSwapInt32(&w.stopFlag, 0, 1) {
		w.guard.Unlock()
		return
	}
	w.log(LogLevelInfo, "stopping")
	close(w.exitChan)
	w.close()
	w.guard.Unlock()
	w.wg.Wait()
}
1326864
func (t *BucketRateLimiter) Close() (err error) {
	t.cancel()
	return t.egCleaner.Wait()
}
466671
func (s *Stream) Stop() {
	close(s.done)
	// Scanner does not have a Stop() or take a done channel, so for low volume
	// streams Scan() blocks until the next keep-alive. Close the resp.Body to
	// escape and stop the stream in a timely fashion.
	if s.body != nil {
		s.body.Close()
	}
	// block until the retry goroutine stops
	s.group.Wait()
}
1220448
func (es *EventSource) Close() {
	if es.r != nil {
		es.r.Close()
	}
	es.err = ErrClosed
}
114612
func stop(process *os.Process) {
	fmt.Printf("Stopping %s...", AppName)
	if err := Stop(process); err != nil {
		failed(err)
	} else {
		fmt.Println("OK")
	}
}
1144935
func (i *Iterator) Close() error {
	i.r.SetChunk(nil)
	return i.Error()
}
888894
func (c *Chan) Stop() {
	c.mutx.Lock()
	defer c.mutx.Unlock()
	if c.stopch != nil {
		if c.sendch != nil {
			close(c.sendch)
		}

		c.stopch <- true
		close(c.stopch)
	}
}
1267235
func (mux *TypeMux) Stop() {
	mux.mutex.Lock()
	for _, subs := range mux.subm {
		for _, sub := range subs {
			sub.closewait()
		}
	}
	mux.subm = nil
	mux.stopped = true
	mux.mutex.Unlock()
}
1072470
func (c *NotifierKafka) Stop() {
	// closes notifications and messages channels, amongst others
	close(c.stopConsuming)
	c.producer.Close()

	go func() {
		c.wg.Wait()
		close(c.StopChan)
	}()
}
419189
func (e *endpoint) Close() {
	// Tell dispatch goroutine to stop, then write to the eventfd so that
	// it wakes up in case it's sleeping.
	atomic.StoreUint32(&e.stopRequested, 1)
	syscall.Write(e.rx.eventFD, []byte{1, 0, 0, 0, 0, 0, 0, 0})

	// Cleanup the queues inline if the worker hasn't started yet; we also
	// know it won't start from now on because stopRequested is set to 1.
	e.mu.Lock()
	workerPresent := e.workerStarted
	e.mu.Unlock()

	if !workerPresent {
		e.tx.cleanup()
		e.rx.cleanup()
	}
}
895254
func (c *consumer) Close() error {
	if err := c.rawConsumer.Close(); err != nil {
		return err
	}

	return c.slowDetector.Stop()
}
138210
func (n *NSQConsumer) Stop() {
	n.cancel()
	n.wg.Wait()
	n.consumer.Stop()
	<-n.consumer.StopChan
}