Skip to content

Commit

Permalink
Use ref for access to key in InMemKV.
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc committed Jan 6, 2023
1 parent 0b6eb1f commit 0551590
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cs/src/core/Utilities/InMemKV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ private bool SUnlockAndTryXLockAndFindOrAddEntry<TFuncs>(ref TKey key, ref InMem
}
}

AddEntry(key, ref funcs, ref bucket, wasActive);
AddEntry(ref key, ref funcs, ref bucket, wasActive);
return true;
}
catch (Exception)
Expand Down Expand Up @@ -734,7 +734,7 @@ public void AddEntry<TFuncs>(ref TKey key, long hash, ref TFuncs funcs)
bool wasActive = bucket.HasEntries;
try
{
AddEntry(key, ref funcs, ref bucket, wasActive);
AddEntry(ref key, ref funcs, ref bucket, wasActive);
}
catch (Exception)
{
Expand All @@ -750,7 +750,7 @@ public void AddEntry<TFuncs>(ref TKey key, long hash, ref TFuncs funcs)
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void AddEntry<TFuncs>(TKey key, ref TFuncs funcs, ref InMemKVBucket<TKey, THeapKey, TValue, TUserFunctions> bucket, bool wasActive)
private void AddEntry<TFuncs>(ref TKey key, ref TFuncs funcs, ref InMemKVBucket<TKey, THeapKey, TValue, TUserFunctions> bucket, bool wasActive)
where TFuncs : IAddEntryFunctions
{
// At this point we know we will add an entry, so pre-increment the active-bucket count to avoid a race where we add the entry but
Expand Down

0 comments on commit 0551590

Please sign in to comment.