On 5 Dec 2012, at 15:57, Joar Wingfors <[email protected]> wrote:

> What happens if you remove the "isCancelled" checks?

No effect on blocking. 


> How do you create your operation queue?

        if ( self.operationQueue == nil )       
        {               
                self.operationQueue = [ [ NSOperationQueue alloc ] init ];
                
                #ifdef OBSERVE_OPERATION_COUNT  <-- has no effect on blocking
                [ self.operationQueue   addObserver:    self  
                                                                forKeyPath:     
kOperationCount 
                                                                options:        
        0 
                                                                context:        
        (__bridge void *)kOperationCount
                ];
                #endif
        }
        else
        {
                [ self.operationQueue cancelAllOperations ];
        };

> What is the max concurrent operation count of the queue? If 
> NSOperationQueueDefaultMaxConcurrentOperationCount, what happens if you set 
> it to (processorCount) instead?

With (processorCount) it does no longer block. Very strange. This I did not 
expect at all.
With NSOperationQueueDefaultMaxConcurrentOperationCount the app gets blocked 
with more than 8 operations.


> When you take a CPU sample of the process, what are your worker threads 
> mainly doing (work, or being stuck)?

All seem to be in in their main method busy adding square-roots.

>> 
>> 
>> I made a test project with this Operation:
>> 
>> @implementation GmdOperationBasis
>> - (void)main
>> {
>>      if ( [ self isCancelled ] ) return;
>>      double sum = 8;
>>      for( NSUInteger i = 0; i < 133833333; i++ )     
>>      {
>>              if ( [ self isCancelled ] ) return;
>>              double j = (double)i;
>>              sum += sqrt(j);
>>      };      
>> }
>> @end 
>> 
>> When I add less than 8 operations to the queue, all is fine.
>> 
>> When I add 8 or more operations to NSOperationQueue (using 
>> NSOperationQueueDefaultMaxConcurrentOperationCount concurrent ops) ,
>> - then switch to some other app, 
>> - then try to make my app active again, I get a beach-ball.
>> 
>> My app becomes responsive again, when all operations have finished.
>> 
>> processorCount = 8 (as reported by NSProcessInfo).
>> 
>> 10.8.2. Xcode 4.5.2.


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to