multithreading - Inter-thread communication in Swift? -


itemprop = "text">

My goal is to parse a large XML file (20 GB) with swift. There are some performance problems with NSXMLParser and Swift Bridging the object, so I'm looking at multi-threading. Specifically lower division:

  1. The main thread - purse data
  2. The worker submits the thread-type type in SWIFT and sends it to 1. Casting of ObjC NSDictionary [String: string] is the biggest obstacle, it is also the main reason for isolating it on multiple threads.
  3. Worker thread - Parsing XML in OBC types - and sends 2. NSXLL parse is a push-parser, once you start parsing, you can not stop it.

The data should be parsed sequentially, so the input order should be maintained. I think allow two parallel processing of non-blocking to run an NSRunLoop on both 1 and 2. According to the documentation of the apple, communication between the thread can be obtained by calling. However this symbol is not available in Swift.

I do not think GCD will fit in the form of a solution

How can one get up to (like NSRunLoops on many sources) using swift?

I used the first time last month, and for this subclass An easy easy object, you can either chain them together with the whole block or you can set the operations for each other's dependency so that they can be executed sequentially.

Passing in the object is also very easy to communicate with NSOption.

NSHipster:


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -