Example #1
0
 protected override bool keyEqual(TKey key, Boxed <TKey> entryKey)
 {
     //NOTE: slots are claimed in two stages - claim a hash, then set a key
     //      it is possible to observe a slot with a null key, but with hash already set
     //      that is not a match since the key is not yet in the table
     return(entryKey != null && _keyComparer.Equals(key, entryKey.Value));
 }
Example #2
0
        protected override bool TryClaimSlotForCopy(ref Boxed <TKey> entryKey, Boxed <TKey> key)
        {
            var entryKeyValue = entryKey;

            if (entryKeyValue == null)
            {
                entryKeyValue = Interlocked.CompareExchange(ref entryKey, key, null);
                if (entryKeyValue == null)
                {
                    // claimed a new slot
                    this.allocatedSlotCount.Increment();
                    return(true);
                }
            }

            return(_keyComparer.Equals(key.Value, entryKey.Value));
        }
Example #3
0
 protected override TKey keyFromEntry(Boxed <TKey> entryKey)
 {
     return(entryKey.Value);
 }