title: Do you need to consider thread-safety using NSURLConnection? - iOS
body: <p>I've just been wondering for a while now how exactly asynchrounous requests work with NSURLConnection.</p>
  
  <p>For example, suppose you have several upload processes running in your application, all initialized using different instances of NSURLConnection. As uploading processes, your wrapper objects gets the NSURLConnection delegate methods called, like:</p>
  
  <pre><code>-(void)connectionDidFinishLoading:(NSURLConnection*)connection;
  </code></pre>
  
  <p>Suppose that in all your NSURLConnection wrapper objects share the same delegate object which have a list of all active uploads in an array, and that when the connectionDidFinishLoading gets called for all your connections, they go in and remove themself from that list in the shared delegate object.</p>
  
  <p>The question then is, do you have to worry about thread-safety when those connection objects can access the same array? Or does all those delegate methods go back to the main-thread in such a way that you are not supposed to worry about thread-safety?</p>