Assume that i have the hashset below
HashSet<string> hsWaitingToBeFetched = new HashSet<string>();
Now i am doing multithreading programming so i have to lock this in order to sync objects
I can lock this with both way are there any performance difference ?
private Object lockHashset = new Object();
lock(lockHashset)
{
// do stuff here
}
or
lock(hsWaitingToBeFetched)
{
// do stuff here
}