Tutorial :objective C sequential launching thread



Question:

I have a scenario, working on iPhone development.

I got 3 threads , 2 thread performs XML parsing operation and the last one verification operation.

How to run them sequentially.

Any help!.


Solution:1

You want to look at NSOperation and NSOperationQueue - when you have an NSOperation, you can call "addDependency" and that way the operation will not run until the other dependancies are complete.

Look for "Setting Dependencies" halfway down this document:

http://developer.apple.com/cocoa/managingconcurrency.html

Note that you can have an NSOperationQueue have more than one worker thread, so it could handle all of the XML parsing operations and the verification one.


Solution:2

If you want to run the process sequentially - just use one thread.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »