title: Multithreaded downloading a single file in Objective-c
body: <p>I have an array with an object 'Chunk' which looks like this:</p>
  
  <pre><code>typedef enum
  {
  Connecting = 0,
  Downloading,
  Finished,
  Error
  } State;
  
  @interface Chunk : NSObject
  
  @property (atomic) uint64_t startingByte;
  @property (atomic) uint64_t endingByte;
  @property (atomic) NSString *md5;
  @property (atomic) State *chunkState;
  
  @end
  </code></pre>
  
  <p>There's also a Download object which holds the link to the file, its size and downloadedBytes. The download objects has an array as a property (which holds chunks).</p>
  
  <p>What's the best way to download the file in for example 6 threads? Each thread downloading one chunk at a time (the idea it to merge them at the end). Should I use gdc or somekind of a queue system?</p>