Demystify NSOperation: simultaneous and non-competitive and asynchronous

Yes I know. There NSOperationare many questions and answers in the world , but I still have some doubts. I try to explain my doubts with two questions. They are connected to each other.

In a SO post, nsoperationqueue-and-concurrent-vs-non-concurrent Darren wrote that

The operation "parallel" is parallel in itself; it is not needed by NSOperationQueue to create a thread for it.

But a little distorted, I found that NSOperationeven if it is declared parallel (by overriding a method isConcurrentsuch as it returns YES), it can be added to NSOperationQueue. What does it mean? If I add parallel NSOperationto the queue, what happens under the hood? On the contrary, what happens if I use the parallel operation as is (without adding it to the queue)?

A note taken from an Apple document is clear:

... operation queues ignore the value returned by isConcurrent and always call the method to start your operation from a separate thread .... In general, if you always use operations with the operation queue, there is no reason for they to be parallel.

async- NSOperation. Dave Dribin ( ). .

(, async NSURLConnection), . main, . , start ... .

, , start .

- (void)start
{
    if (![NSThread isMainThread])
    {
        [self performSelectorOnMainThread:@selector(start) withObject:nil waitUntilDone:NO];
        return;
    }

    // other code here...
}

API- , .

, ?

.

+5
2

-, isConcurrent NSOperation . "". , -start , , ()? , ()?

Apple docs, , NSOperationQueue, , . , . , -start , .

, -start ? , . NSOperationQueue .

, , . NSURLConnection - . , , a), , b) . NSOperationQueue .

, , , , , , .

, , . . , , - , , , . , , NSURLConnection , - , , .

, , , , . , , , , , . . , .

+11

, :

2009-09-13: 10.6. 10.6. API, , . .

+1

All Articles