// Release will return n units to the semaphore and notify any currently
// blocking Acquire calls.
8182
func (s *Sem) Release(n int64) {
	s.c.L.Lock()
	defer s.c.L.Unlock()
	debug.Printf("Release max %d free %d, n %d", s.max, s.free, n)
	s.free += n
	s.c.Broadcast()
}
1007021
func (r *BasicReleaser) Release() {
	if !r.released {
		if r.releaser != nil {
			r.releaser.Release()
			r.releaser = nil
		}
		r.released = true
	}
}
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))
}
600835
func (snap *dbCacheSnapshot) Release() {
	snap.dbSnapshot.Release()
	snap.pendingKeys = nil
	snap.pendingRemove = nil
}
730585
func (client *Client) Release() string {
	client.mu.RLock()
	defer client.mu.RUnlock()

	return client.release
}
139117
func (h *Handle) Release() {
	nPtr := atomic.LoadPointer(&h.n)
	if nPtr != nil && atomic.CompareAndSwapPointer(&h.n, nPtr, nil) {
		n := (*Node)(nPtr)
		n.unrefLocked()
	}
}
780098
func (s *Semaphore) Release() error {
	// Hold the lock as we try to release
	s.l.Lock()
	defer s.l.Unlock()

	// Ensure the lock is actually held
	if !s.isHeld {
		return ErrSemaphoreNotHeld
	}

	// Set that we no longer own the lock
	s.isHeld = false

	// Stop the session renew
	if s.sessionRenew != nil {
		defer func() {
			close(s.sessionRenew)
			s.sessionRenew = nil
		}()
	}

	// Get and clear the lock session
	lockSession := s.lockSession
	s.lockSession = ""

	// Remove ourselves as a lock holder
	kv := s.c.KV()
	key := path.Join(s.opts.Prefix, DefaultSemaphoreKey)
READ:
	pair, _, err := kv.Get(key, nil)
	if err != nil {
		return err
	}
	if pair == nil {
		pair = &KVPair{}
	}
	lock, err := s.decodeLock(pair)
	if err != nil {
		return err
	}

	// Create a new lock without us as a holder
	if _, ok := lock.Holders[lockSession]; ok {
		delete(lock.Holders, lockSession)
		newLock, err := s.encodeLock(lock, pair.ModifyIndex)
		if err != nil {
			return err
		}

		// Swap the locks
		didSet, _, err := kv.CAS(newLock, nil)
		if err != nil {
			return fmt.Errorf("failed to update lock: %v", err)
		}
		if !didSet {
			goto READ
		}
	}

	// Destroy the contender entry
	contenderKey := path.Join(s.opts.Prefix, lockSession)
	if _, err := kv.Delete(contenderKey, nil); err != nil {
		return err
	}
	return nil
}
51160
func (c *DefaultPlanner) Release(groups []CompactionGroup) {
	c.mu.Lock()
	defer c.mu.Unlock()
	for _, g := range groups {
		for _, f := range g {
			delete(c.filesInUse, f)
		}
	}
}
507314
func (c *CameraModel) Release() {
	C.EdsRelease((*C.struct___EdsObject)(unsafe.Pointer(&c.camera)))
}
452121
func (d *DeviceMapperDriver) Release(volumeName string) error {
	glog.V(2).Infof("Release() (%s) START", volumeName)
	defer glog.V(2).Infof("Release() (%s) END", volumeName)
	vol, err := d.getVolume(volumeName, false)
	if err != nil {
		return err
	}
	if mounted, _ := devmapper.Mounted(vol.Path()); mounted {
		glog.V(1).Infof("Unmounting %s", volumeName)
		if err := vol.unmount(); err != nil {
			glog.Errorf("Error whilst unmounting %s: %s", vol.path, err)
			return err
		}
	}
	deviceHashes := vol.Metadata.ListDevices()
	for _, deviceHash := range deviceHashes {
		if deviceHash == "" {
			// this can happen when all previously active devices have been deactivated
			continue
		}

		// Perversely, DeactivateDevice() will not actually work unless the device is activated.
		// GetDeviceStatus() will both verify that device is valid, and it has the side-effect of activating
		// the device if the device is not active.
		if status, err := d.DeviceSet.GetDeviceStatus(deviceHash); err != nil {
			glog.Errorf("For volume %s, unable to get status for device %q: %s", volumeName, deviceHash, err)
			continue
		} else if status == nil {
			glog.V(2).Infof("For volume %s, no status available for device %q", volumeName, deviceHash)
		} else {
			glog.V(2).Infof("For volume %s, status for device %q: %v", volumeName, deviceHash, status)
		}

		glog.V(1).Infof("Deactivating device (%s)", deviceHash)
		d.DeviceSet.Lock()
		err := d.DeactivateDevice(deviceHash)
		d.DeviceSet.Unlock()
		if err != nil {
			glog.Errorf("Error removing device %q for volume %s: %s", deviceHash, volumeName, err)
			return err
		}
		glog.V(2).Infof("Deactivated device")
	}
	return nil
}
157942
func (r *Reader) Release() {
	r.mu.Lock()
	defer r.mu.Unlock()

	if closer, ok := r.reader.(io.Closer); ok {
		closer.Close()
	}
	if r.indexBlock != nil {
		r.indexBlock.Release()
		r.indexBlock = nil
	}
	if r.filterBlock != nil {
		r.filterBlock.Release()
		r.filterBlock = nil
	}
	r.reader = nil
	r.cache = nil
	r.bpool = nil
	r.err = ErrReaderReleased
}
586276
func (db *Database) Release(sid string) {
	// clear all $sid-$key.
	db.Clear(sid)
	// and remove the $sid.
	txn := db.Service.NewTransaction(true)
	txn.Delete([]byte(sid))
	txn.Commit(nil)
}
597366
func (c *channelPool) Release() {
	c.mu.Lock()
	conns := c.conns
	c.conns = nil
	c.factory = nil
	c.ping = nil
	closeFun := c.close
	c.close = nil
	c.mu.Unlock()

	if conns == nil {
		return
	}

	close(conns)
	for wrapConn := range conns {
		closeFun(wrapConn.conn)
	}
}
682617
func (s *Session) release() error {
	return s.Wallet.card.Disconnect(pcsc.LeaveCard)
}
317193
func (device *Device) Release() {
	C.cairo_device_release(device.Ptr)
	if err := device.status(); err != nil {
		panic(err)
	}
}
115852
func (s *State) Release() {
	s.dbCond.L.Lock()
	defer s.dbCond.L.Unlock()
	s.dbUsers--
	if s.dbUsers == 0 {
		s.dbCond.Broadcast()
	}
}
368020
func (s *OIDSet) Release() (err error) {
	if s == nil || s.C_gss_OID_set == nil {
		return nil
	}

	var min C.OM_uint32
	maj := C.wrap_gss_release_oid_set(s.Fp_gss_release_oid_set, &min, &s.C_gss_OID_set)
	return s.stashLastStatus(maj, min)
}