2

Im learning GCD. Please consider following code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    dispatch_sync(dispatch_get_main_queue(), ^{
        NSLog(@"Hello world");
    });

   /* Another implementation */
   return YES;
}

I know, that there will be a deadlock. But can somebody explain why? What exactly steps application will do, before it (app) will "freeze"?

Evgeniy Kleban
  • 6,794
  • 13
  • 54
  • 107

1 Answers1

1

because the code runs in main queue and you tell it to wait for the block to execute in main queue

du30
  • 21
  • 3