Esempio n. 1
0
File: Calls.cs Progetto: ame89/nfx
        /// <summary>
        /// Tries to get, return and remove CallSlot instance by its RequestID from the list.
        /// Returns null if CallSlot with such an id does not exist and nothing was removed
        /// </summary>
        public CallSlot TryGetAndRemove(FID requestID)
        {
            //getBucket() inlined for performance
            var idx    = Math.Abs(requestID.GetHashCode() % m_BucketCount);
            var bucket = m_Buckets[idx];

            CallSlot result;

            if (bucket.TryRemove(requestID, out result))
            {
                return(result);
            }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Tries to get, return and remove CallSlot instance by its RequestID from the list.
        /// Returns null if CallSlot with such an id does not exist and nothing was removed
        /// </summary>
        public CallSlot TryGetAndRemove(FID requestID)
        {
            //getBucket() inlined for performance
            var idx    = (requestID.GetHashCode() & CoreConsts.ABS_HASH_MASK) % m_BucketCount;
            var bucket = m_Buckets[idx];

            CallSlot result;

            if (bucket.TryRemove(requestID, out result))
            {
                return(result);
            }

            return(null);
        }