title: iphone - asynchronous upload and download operation freezes the UI
body: <p>In my app , I want to achieve multiple uploads and downloads using Websocket protocol.</p>
  
  <p>For that purpose , I have made class called <code>Engine</code> , <code>Upload</code> and <code>Download</code>  </p>
  
  <p><code>Engine</code> - creates a <code>operationQueue</code> and <code>maximumConcurrentOperation</code> is 3 .</p>
  
  <p><code>Upload</code> and <code>Download</code> - subclass of <code>NSOperation</code> and override the <code>main</code> method . In <code>main</code> method , both the class have following statements</p>
  
  <pre><code>Engine.m
  -(id)init
  {
       if(self = [super init])
       {
            opQueue = [[NSOperationQueue alloc] init];
            opQueue.maximumConcurrentOperationCount = 3 ;
       }
  }
  -(void)startUploadWithPath:(NSString *)file
  {
      Upload *up = [[Upload alloc] initWithPath:file];
      [opQueue addOperation:up];
  }
  
  -(void)startDownloadWithPath:(NSString *)file
  {
      Download *down = [[Upload alloc] initWithPath:file];
      [opQueue addOperation:down];
  }
  
  Upload.m and Download.m
  -(void)main
  {
     //start transfering data to server
  
     while(workCompleted != YES)
      {
          // wait()
      } 
  
      // when work completed
      //insertIntoDB();
  }
  </code></pre>
  
  <p><strong>Problem :</strong>  When I try to upload first video , then it works fine . Immidiately if I try to upload second video , then also it works fine . When I try to upload third video(i.e when I select video from gallery and video compression has not began yet) , the application freeze . The application becomes active only when one of the two previous video upload is completed .</p>
  
  <p>Why does the application freeze even if <code>maxConcurrentOperationCount</code> is 3 ?</p>
  
  <p>Thanks in advance.</p>