title: What behavior is guaranteed with Grand Central Dispatch in Objective-C?
body: <p>I think the best way to ask this question is with some code:</p>
  
  <pre><code>//Main method
  for(int i = 0; i &lt; 10; i++)
  {
      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
           [self foo:i];
      });
  
  }
  
  - (void) foo: (int) i
  {
      @synchronized(self)
      {
          NSLog(@"%d",i);
      }
  }
  </code></pre>
  
  <p>In this case, is it guaranteed that the numbers 0-9 will be printed out in order? Is there ever a chance that one of the threads that is waiting on the run queue, will be skipped over?  How about in reality. Realistically, does that ever happen?  What if I wanted the behavior above (still using threads); how could I accomplish this?</p>