dispatch_get_main_queue() in main thread dispatch_get_main_queue() in main thread multithreading multithreading

dispatch_get_main_queue() in main thread


There isn't a problem with adding an asynchronous block on the main queue from within the main queue, all it does is run the method later on in the run loop.

What you definitely don't want to do is to call dispatch_sync adding a block to the main queue from within the main queue as you'll end up locking yourself.


Don't worry if you are calling dispatch_async in main thread or not. iOS will put the block in a queue and execute the block in main thread.