// Close event channels when done message is received
438019
func (w *Watcher) finish() {
	close(w.Fork)
	close(w.Exec)
	close(w.Exit)
	close(w.Error)
}
229292
func (t *AsyncTransport) Close() error {
	close(t.bodyChannel)
	t.Wait()
	return nil
}
1265317
func (l *Listener) Close() error {
	l.once.Do(func() {
		close(l.done)
		<-l.rmvd
	})
	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
}
1182326
func (m *ChannelDeMultiplexer) Close() {
	m.lock.Lock()
	defer m.lock.Unlock()
	m.closed = true
	for _, ch := range m.channels {
		close(ch.ch)
	}
	m.channels = nil
}
83577
func (c *IO) Close(handle string) (*gcdmessage.ChromeResponse, error) {
	var v IOCloseParams
	v.Handle = handle
	return c.CloseWithParams(&v)
}
345795
func (q *Queue) Close() error {
	// Make sure all watchers have been closed to avoid a deadlock when
	// closing the broadcaster.
	q.mu.Lock()
	for _, cancelFunc := range q.cancelFuncs {
		cancelFunc()
	}
	q.cancelFuncs = make(map[events.Sink]func())
	q.mu.Unlock()

	return q.broadcast.Close()
}
381029
func (p *DefaultChannelClient) Close() error {
	p.usersMutex.RLock()
	defer p.usersMutex.RUnlock()
	for _, user := range p.users {
		user.close()
	}
	return p.client.closeChannel(p)
}
1330102
func (c *Client) Close() error {
	c.once.Do(c.startLoop)
	c.quit <- struct{}{}
	close(c.msgs)
	<-c.shutdown
	return nil
}
462148
func (client Client) Close() error {
	err := client.Sender.Close()
	return errors.Trace(err)
}
518371
func (c *client) Close() error {
	c.once.Do(func() {
		close(c.stop)
		if err := c.conn.Write(pdu.NewUnbind()); err == nil {
			select {
			case <-c.inbox: // TODO: validate UnbindResp
			case <-time.After(time.Second):
			}
		}
		c.conn.Close()
	})
	return nil
}
334695
func (r *Receiver) Close() error {
	r.cl.Lock()
	defer r.cl.Unlock()
	if r.cl.client == nil {
		return ErrNotConnected
	}
	close(r.chanClose)
	return r.cl.Close()
}
461342
func (r *OutputDebugStringReceiver) Close() error {
	if nil == r.err {
		r.done <- struct{}{}
		<-r.completed
	}

	var result, err error
	result = r.dataReadyEvent.Close()

	err = r.bufferReadyEvent.Close()
	if nil != result {
		result = err
	}

	if 0 != r.view {
		err = windows.UnmapViewOfFile(r.view)
		if nil != result {
			result = err
		}
	}

	if windows.InvalidHandle != r.buffer {
		err = windows.CloseHandle(r.buffer)
		if nil != result {
			result = err
		}
	}

	return result
}
778390
func ChannelClose(ch chan *Message) bool {
	select {
	case _, ok := <-ch:
		if ok {
			close(ch)
			return true
		}
	default:
	}
	return false
}
817353
func (mw *masterWindow) Close() {
	mw.wnd.Send(lifecycle.Event{From: lifecycle.StageAlive, To: lifecycle.StageDead})
}
899386
func (process *TeleportProcess) Close() error {
	process.BroadcastEvent(Event{Name: TeleportExitEvent})

	process.Config.Keygen.Close()

	var errors []error
	localAuth := process.getLocalAuth()
	if localAuth != nil {
		errors = append(errors, process.localAuth.Close())
	}

	if process.storage != nil {
		errors = append(errors, process.storage.Close())
	}

	return trace.NewAggregate(errors...)
}
918122
func (c *GRPCConnection) Close() {
	if !c.setClosed() {
		logger.Debug("Already closed")
		return
	}

	logger.Debug("Releasing connection....")
	c.commManager.ReleaseConn(c.conn)

	logger.Debug("... connection successfully closed.")
}