code_junkie

ReaderWriterLockSlim vs. Monitor

Nov 13th, 2011
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. public void Add(TKey key, TValue value)
  2. {
  3. int poolIndex = GetPoolIndex(key);
  4. this.locks[poolIndex].EnterWriteLock();
  5. try
  6. {
  7. this.pools[poolIndex].Add(key, value);
  8. }
  9. finally
  10. {
  11. this.locks[poolIndex].ExitWriteLock();
  12. }
  13. }
Add Comment
Please, Sign In to add comment