I intend to around existing code snippet (updating a Hashtable) with lock() block to prevent multiple threads (launched by ASP.NET web site) from simultaneously updating a Hashtable.
B\c this is first time I do in this measure, I need your advice on
- Any performance overhead caution caused by lock()
- Any other issues you ever experienced similar to this scenarios.
I appreciate any advices.
lock is okay, a better approach would be the ReaderWriterLock(Slim). Matt provides a nice wrapper that allows usage in a using-block.