// closeAll disconnects all watchers (presumably in response to a Shutdown call).
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{}
}
67506
func (t *TaskWatcher) Close() error {
	for _, x := range t.taskIDs {
		t.parent.rm(x, t)
	}
	return nil
}
96592
func (c *chanList) dropAll() []*channel {
	c.Lock()
	defer c.Unlock()
	var r []*channel

	for _, ch := range c.chans {
		if ch == nil {
			continue
		}
		r = append(r, ch)
	}
	c.chans = nil
	return r
}
1104863
func (w *Watcher) close(txn storage.Transaction, migrating bool) {
	w.trigger.Unregister(w.ctx, txn)
	if !migrating {
		for h := range w.handles {
			h.shutDown(nil)
		}
	}
	w.handles = map[*Handle]struct{}{}
	w.dataWatch = map[string]map[signal]struct{}{}
	w.closed = true
}
102393
func (c *RPCClient) Close() error {
	c.shutdownLock.Lock()
	defer c.shutdownLock.Unlock()

	if !c.shutdown {
		c.shutdown = true
		close(c.shutdownCh)
		c.deregisterAll()
		return c.conn.Close()
	}
	return nil
}
1197200
func (c *Client) WatchAll() (params.AllWatcherId, error) {
	if err := c.checkCanRead(); err != nil {
		return params.AllWatcherId{}, err
	}
	model, err := c.api.stateAccessor.Model()
	if err != nil {
		return params.AllWatcherId{}, errors.Trace(err)
	}

	// Since we know this is a user tag (because AuthClient is true),
	// we just do the type assertion to the UserTag.
	apiUser, _ := c.api.auth.GetAuthTag().(names.UserTag)
	isAdmin, err := common.HasModelAdmin(c.api.auth, apiUser, c.api.stateAccessor.ControllerTag(), model)
	if err != nil {
		return params.AllWatcherId{}, errors.Trace(err)
	}
	watchParams := state.WatchParams{IncludeOffers: isAdmin}

	w := c.api.stateAccessor.Watch(watchParams)
	return params.AllWatcherId{
		AllWatcherId: c.api.resources.Register(w),
	}, nil
}
1115420
func (c *Connection) shutdown() {
	c.log("SHUTDOWN", "starts")
	c.shutdownHeartBeats()
	// Close all individual subscribe channels
	// This is a write lock
	c.subsLock.Lock()
	for key := range c.subs {
		close(c.subs[key].md)
		c.subs[key].cs = true
	}
	c.connLock.Lock()
	c.connected = false
	c.connLock.Unlock()
	c.subsLock.Unlock()
	c.log("SHUTDOWN", "ends")
	return
}
1044141
func (p *PortAllocator) ReleaseAll() error {
	p.mutex.Lock()
	p.ipMap = ipMapping{}
	p.mutex.Unlock()
	return nil
}
327605
func (net *Network) StopAll() error {
	for _, node := range net.Nodes {
		if !node.Up() {
			continue
		}
		if err := net.Stop(node.ID()); err != nil {
			return err
		}
	}
	return nil
}
627047
func (w *Watcher) Close() error {
	w.mu.Lock()
	if w.isClosed {
		w.mu.Unlock()
		return nil
	}
	w.isClosed = true
	w.mu.Unlock()

	// Send "quit" message to the reader goroutine
	w.done <- true
	w.wmut.Lock()
	ws := w.watches
	w.wmut.Unlock()
	for path := range ws {
		w.removeWatch(path)
	}

	return nil
}
413135
func (c *Client) Close() {
	c.lock.Lock()
	defer c.lock.Unlock()
	c.terminal = true
	c.closeAsyncAndWait(c.parameters.ShutdownTimeout)
	c.subscriptions.Close()

	// clean shutdown waits on shutdown channel, which is triggered by cascading resource
	// cleanups after a closed asynchronous transport
	timeout := make(chan bool)
	go func() {
		time.Sleep(c.parameters.ShutdownTimeout)
		close(timeout)
	}()
	select {
	case <-c.asynchronous.Done():
		close(c.shutdown) // kill reset socket listener
		return // successful cleanup
	case <-timeout:
		c.log.Debug("shutdown timed out")
		return
	}
}
316049
func (u *Supervisor) CancelAll() {
	u.l.Lock()
	defer u.l.Unlock()

	for _, update := range u.updates {
		update.Cancel()
	}
}
743240
func (ch *Channel) shutdown(e *Error) {
	ch.destructor.Do(func() {
		ch.m.Lock()
		defer ch.m.Unlock()

		// Grab an exclusive lock for the notify channels
		ch.notifyM.Lock()
		defer ch.notifyM.Unlock()

		// Broadcast abnormal shutdown
		if e != nil {
			for _, c := range ch.closes {
				c <- e
			}
		}

		// Signal that from now on, Channel.send() should call
		// Channel.sendClosed()
		atomic.StoreInt32(&ch.closed, 1)

		// Notify RPC if we're selecting
		if e != nil {
			ch.errors <- e
		}

		ch.consumers.close()

		for _, c := range ch.closes {
			close(c)
		}

		for _, c := range ch.flows {
			close(c)
		}

		for _, c := range ch.returns {
			close(c)
		}

		for _, c := range ch.cancels {
			close(c)
		}

		// Set the slices to nil to prevent the dispatch() range from sending on
		// the now closed channels after we release the notifyM mutex
		ch.flows = nil
		ch.closes = nil
		ch.returns = nil
		ch.cancels = nil

		if ch.confirms != nil {
			ch.confirms.Close()
		}

		close(ch.errors)
		ch.noNotify = true
	})
}
294808
func (c *client) shutdown() {
	c.closeLock.Lock()
	defer c.closeLock.Unlock()

	if c.closed {
		return
	}
	c.closed = true
	close(c.closedCh)

	if c.ipv4conn != nil {
		c.ipv4conn.Close()
	}
	if c.ipv6conn != nil {
		c.ipv6conn.Close()
	}
}
666942
func (p *ExamplePlugin) Close() error {
	p.Log.Info("Close plugin..")
	// Close the watcher
	p.cancel()
	p.wg.Wait()
	return nil
}
1187498
func (connection *redisConnection) CloseAllQueuesInConnection() error {
	connection.redisClient.Del(connection.queuesKey)
	// debug(fmt.Sprintf("connection closed all queues %s %d", connection, connection.queuesKey)) // COMMENTOUT
	return nil
}
458890
func (s *SvcProvider) WatchAll(rsps chan core.WatchState) error {
	return s.StateDriver.WatchAllState(svcProviderPathPrefix, s, json.Unmarshal,
		rsps)
}