// Release is called when a file handle is no longer needed.  This is
// called asynchronously after the last handle to a file is closed.
4538
func (h *mutFileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) error {
	h.tmp.Close()
	os.Remove(h.tmp.Name())
	h.tmp = nil

	return nil
}
1159662
func (e *Etcd) Release(item int) error {
	e.lock.Lock()
	defer e.lock.Unlock()

	if err := e.alloc.Release(item); err != nil {
		return err
	}

	return e.tryUpdate(func() error {
		return e.alloc.Release(item)
	})
}
1094356
func (r *ReleaseReadCloser) Release() io.ReadCloser {
	result := r.ReadCloser
	r.ReadCloser = nil
	return result
}
1062537
func (d *NFSDriver) Release(volumeName string) error {
	if !d.networkDisabled {
		//actual NFS mount
		volumePath := filepath.Join(d.root, volumeName)
		if err := unmount(volumePath); err != nil {
			return err
		}
	}
	return nil
}
78671
func (e *ClientExecutor) Release() []error {
	errs := e.Volumes.Release()
	for _, fn := range e.Deferred {
		if err := fn(); err != nil {
			errs = append(errs, err)
		}
	}
	e.Deferred = nil
	return errs
}
335758
func (c *Client) Close() {
	if c.file != nil && c.file != os.Stdout {
		c.file.Close()
	}
}
530242
func (p *multiResourcePool) Release(handle ManagedHandle) error {
	pool := p.getPool(handle.ResourceLocation())
	if pool == nil {
		return errors.New(
			"Resource pool cannot take control of a handle owned " +
				"by another resource pool")
	}

	return pool.Release(handle)
}
782632
func (sm *SourceMgr) Release() {
	// Set sm.releasing before entering the Once func to guarantee that no
	// _more_ method calls will stack up if/while waiting.
	atomic.CompareAndSwapInt32(&sm.releasing, 0, 1)

	// Whether 'releasing' is set or not, we don't want this function to return
	// until after the doRelease process is done, as doing so could cause the
	// process to terminate before a signal-driven doRelease() call has a chance
	// to finish its cleanup.
	sm.relonce.Do(func() { sm.doRelease() })
}
820966
func (ref *Reference) Release() {
	ref.once.Do(func() {
		live.untrack(ref)
		ref.wg.Done()
	})
}
1183770
func (r *Allocator) Release(id uint32) error {
	ok, offset := r.netIDRange.Contains(id)
	if !ok {
		return nil
	}
	return r.alloc.Release(int(offset))
}
1000624
func (lk *consulLock) Release() error {

	// Mark this as released
	lk.mutex.Lock()
	lk.isReleased = true
	lk.mutex.Unlock()

	// Send stop signal on stop channel
	close(lk.stopChan)

	// If the lock was acquired, release it
	if lk.IsAcquired() {
		lk.setAcquired(false)

		// Release it via consul client
		succ, _, err := lk.client.KV().Release(&api.KVPair{Key: lk.keyName, Value: []byte(lk.myID), Session: lk.sessionID}, nil)
		if err != nil {
			log.Errorf("Error releasing key %s/%s, Err: %v", lk.keyName, lk.myID, err)
			return err
		}

		if !succ {
			log.Warnf("Failed to release the lock %s/%s. !success", lk.name, lk.myID)
		}

	}

	return nil
}
832394
func (lk *etcdLock) Release() error {
	keyName := "/contiv.io/lock/" + lk.name

	lk.mutex.Lock()
	defer lk.mutex.Unlock()

	// Mark this as released
	lk.isReleased = true

	// Send stop signal on stop channel
	lk.stopChan <- true

	// If the lock was acquired, release it
	if lk.isAcquired {
		// Delete the lock entry
		resp, err := lk.kapi.Delete(context.Background(), keyName, &client.DeleteOptions{PrevValue: lk.myID})
		if err != nil {
			log.Errorf("Error Deleting key. Err: %v", err)
		} else {
			log.Infof("Deleted key lock %s, Resp: %+v", keyName, resp)
		}

		lk.isAcquired = false
	}

	return nil
}
122766
func (r *Allocator) Release(block uid.Block) error {
	ok, offset := r.contains(block)
	if !ok {
		// TODO: log a warning
		return nil
	}

	return r.alloc.Release(int(offset))
}
1303992
func (l *FileLog) Close() error {
	l.Lock()
	defer l.Unlock()

	var err error
	if l.file != nil {
		err = l.file.Close()
		l.file = nil
	}
	return err
}
466777
func (c *ClientContext) Release() error {
	if c == nil {
		return nil
	}
	return c.sctxt.Release()
}
507314
func (c *CameraModel) Release() {
	C.EdsRelease((*C.struct___EdsObject)(unsafe.Pointer(&c.camera)))
}
1224228
func (oid *OID) Release() error {
	if oid == nil || oid.C_gss_OID == nil {
		return nil
	}

	switch oid.alloc {
	case allocMalloc:
		// same as with get and set, use a C helper to free(oid.C_gss_OID.elements)
		C.helper_gss_OID_desc_free_elements(oid.C_gss_OID)
		C.free(unsafe.Pointer(oid.C_gss_OID))
		oid.C_gss_OID = nil
		oid.alloc = allocNone
	}

	return nil
}