func()

in src/gowrapper/marshal/storage.go [96:115]


func (m *xlangRefMap) Decref(id Handle) {
	m.lock.RLock()
	ref, ok := m.m[id]
	m.lock.RUnlock()

	if !ok {
		panic(errors.New("Cannot find object for specified handle: " + strconv.FormatUint(id, 10)))
	}

	refs := atomic.AddUint32(&ref.refs, ^uint32(0))
	if refs != 0 {
		return
	}

	m.lock.Lock()
	if atomic.LoadUint32(&ref.refs) == 0 {
		delete(m.m, id)
	}
	m.lock.Unlock()
}