title: How does @synchronized work?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1215330/how-does-synchronized-lock-unlock-in-objective-c">How does @synchronized lock/unlock in Objective-C?</a>  </p>
  </blockquote>
  
  
  
  <p>I have an application that creates several objects. Each of these objects is essentially running in a different thread, and operating on an <code>NSMutableArray</code> which is part of a separate class. There are several different methods in this class that enumerate and mutate the array, and as expected the multiple threads do not work well with this. I have tried surrounding all the method bodies in <code>@synchronized</code> blocks, as I read somewhere that that would lock the methods to one thread at a time, but it doesn't seem to have helped. How can I make sure that only one thread is accessing these methods at a time?</p>