Example #1
0
        /// <summary>
        /// 引用+1
        /// </summary>
        public bool Retain(object refer_)
        {
            if (IsDisposed(true))
            {
                return(false);
            }


            if (refer_ != null)
            {
                string referId = Refer.Format(refer_);
                if (m_refHash.Contains(referId))
                {
                    //已被它引用
                    return(false);
                }
                m_refHash.Add(referId);
                Refer.AttachDispose(referId, OnReferDispose);   //监听引用者销毁
            }

            m_ref_cnt++;
            if (m_ref_cnt == 1)
            {
            }

            return(true);
        }