title: Making stringWithContentsOfURL asynchronous - Is it safe?
body: <p>I attempted to make -[NSString stringWithContentsOfURL:encoding:error:] asynchronous, by running it a-synchronically from a background thread:</p>
  
  <pre><code>__block NSString *result;
  dispatch_queue_t currentQueue = dispatch_get_current_queue();
  
  void (^doneBlock)(void) = ^{
      printf("done! %s",[result UTF8String]);
  };
  
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
                                           (unsigned long)NULL), ^(void) {
      result = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.google.com/"] encoding:NSUTF8StringEncoding error:nil];
      dispatch_sync(currentQueue, ^{
          doneBlock();
      });
  });
  </code></pre>
  
  <p>Its working fine, and most importantly, its asynchronous.</p>
  
  <p>My question is if it's safe to do this, or could there be any threading problems etc.? </p>
  
  <p>Thanks in advance :)</p>