title: Is there a deadlock case for Multiple locks on same object?
body: <p>We have a code with two locks locking on same object in different methods. Both methods can be called from different threads. </p>
  
  <p>Can this go into deadlock scenario ?
  Should we use same lock1 in both methods ? </p>
  
  <p>Reason for using two different locks is that removal happens from various tasks running in parallel but updating the list happens from new thread running every few seconds.</p>
  
  <pre><code>private static Object Lock1 = new Object();
  private static Object Lock2 = new Object();
  private static List&lt;string&gt; list = new List&lt;string&gt;();
  
  public void Method1()
  {
    lock(Lock1)
    {
     //update list
    }
  }
  
  public void Method2()
  {
    lock(Lock2)
    {
      //remove from list
    }   
  }
  </code></pre>
  
  <h2>Update</h2>
  
  <p>Thanks for healthy discussion, I have updated my code to use thread safe collection BlockingCollection provided by .net. I continue to use the lock1 as I need to control how many number of objects the list can contain. I have removed the lock2 now as its not needed with the thread safe list.</p>