title: concurrent NSOperationQueue uploads followed by a single task
body: <p>I'm trying to perform a 2 step process:</p>
  <ol>
  <li>Concurrent upload of photos</li>
  <li>User input then post content</li>
  </ol>
  <p>, which is very similar to how facebook app works when you &quot;Add Photo&quot;</p>
  <p>I want to start the upload of photos first in the background using the default <code>NSOperationQueueDefaultMaxConcurrentOperationCount </code>. These operations will return some info that I need to send together with the 2nd post.</p>
  <p>However, due to the nature of the app and because of concurrency, how can I structure it in the way that I post the content only if the following conditions are met:</p>
  <ol>
  <li>All photos have been uploaded</li>
  <li>User action to post his content</li>
  </ol>
  <p>A few scenarios can happen:</p>
  <ol>
  <li>No photos to post, user post content, the content should be posted immediately</li>
  <li>Photo uploads are complete, user post content, content should be posted immediately</li>
  <li>Photo upload is <strong>not</strong> complete, user post content, need to wait for all photos to upload finish before posting content.</li>
  </ol>
  <p>I think I should create a photo upload <code>NSOperationQueue</code> and check for <code>operationCount</code>. If it's == 0, the content should be posted immediately when the user taps on the <code>UIButton</code>.</p>
  <p>However, how do I wait if the photo upload is not complete? Should I be using <code>waitUntilAllOperationsAreFinished</code> in the following way in pseudocode:</p>
  <pre><code>// User taps on UIButton to post his content and this is in a ViewController
  - void postMyContent:
  {
     [self.photoUploadQ.waitUntilAllOperationsAreFinished]
  
     // Post my content now              
  }
  </code></pre>
  <p>Is this correct? I can't add the 2nd Task to the <code>photoUploadQ</code> since it has the default concurrency.</p>
  <p>I'm concern of deadlock / blocking because of the documentation:</p>
  <blockquote>
  <p>When called, this method blocks the current thread and waits for the receiver’s current and queued operations to finish executing. While the current thread is blocked, the receiver continues to launch already queued operations and monitor those that are executing. During this time, the current thread cannot add operations to the queue, but other threads may. Once all of the pending operations are finished, this method returns.</p>
  <p>If there are no operations in the queue, this method returns immediately.</p>
  </blockquote>
  <p>Thanks!</p>