// Close destroys the CUDA context and associated resources that has been created. Additionally, all channels of communications will be closed.
16296
func (ctx *Ctx) Close() error {
	var empty C.CUcontext
	if ctx.CUContext.ctx == empty {
		return nil
	}

	if ctx.errChan != nil {
		close(ctx.errChan)
		ctx.errChan = nil
	}

	if ctx.work != nil {
		close(ctx.work)
		ctx.work = nil
	}

	err := result(C.cuCtxDestroy(C.CUcontext(unsafe.Pointer(ctx.CUContext.ctx))))
	ctx.CUContext.ctx = empty
	return err
}
785717
func (ics *IterateCloserStruct) Close() error {
	if ics.CloserF != nil {
		return ics.CloserF()
	}
	return nil
}
1221337
func (c *Cache) Close() {
	if !atomic.CompareAndSwapInt32(&c.closed, 0, 1) {
		// Already closed
		return
	}
	logger.Debugf("%s - Closing cache", c.name)
	c.DeleteAll()
}
204927
func (w *Writer) Close() error {
	if w.buffer.Len() > 0 {
		w.write(w.buffer.Bytes())
	}
	return nil
}
1258954
func (nv *NV) Close() error {
	err := tspiError(C.Tspi_Context_CloseObject(nv.context, nv.handle))
	return err
}
413205
func (c *CompileContext) Close() {
	C.mrbc_context_free(c.mrb.state, c.ctx)
}
1168428
func (conn *Conn) Close() error {
	<-conn.ready
	for _, s := range conn.channels {
		s.Close()
	}
	conn.ws.Close()
	return nil
}
164385
func (c *RawKVClient) Close() error {
	c.pdClient.Close()
	return c.rpcClient.Close()
}
1112071
func (c *SocketConnection) Close() error {
	if err := c.Conn.Close(); err != nil {
		return err
	}

	return nil
}
667046
func (cp *CachePool) Close() error {
	err := cp.source.Close()
	if err != nil {
		return errors.WithStack(err)
	}

	err = cp.cache.Close()
	if err != nil {
		return errors.WithStack(err)
	}

	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
}
270218
func (soc *Socket) Close() error {
	if soc.opened {
		soc.opened = false
		if i, err := C.zmq_close(soc.soc); int(i) != 0 {
			soc.err = errget(err)
		}
		soc.soc = unsafe.Pointer(nil)
		soc.ctx = nil
	}
	return soc.err
}
149345
func (c *TransactionContexts) Close() {
	c.mutex.Lock()
	defer c.mutex.Unlock()

	for _, txctx := range c.contexts {
		txctx.CloseQueryIterators()
	}
}
427041
func (mdwrk *Mdwrk) Close() {
	if mdwrk.worker != nil {
		mdwrk.worker.Close()
		mdwrk.worker = nil
	}
}
1249795
func (t Texture) Close() {
	if !engo.Headless() {
		engo.Gl.DeleteTexture(t.id)
	}
}
571965
func (c *Pipeline) Close() error {
	c.mu.Lock()
	c.discard()
	c.closed = true
	c.mu.Unlock()
	return nil
}
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)
}