dispatch_main() asserts when calling from outside the main thread and interrupts your process, it needs to be called only from the main thread.
dispatch_main() is actually nothing more than pthread_exit() in disguise (see implementation ): it turns the main queue into a regular sequential dispatch of the queue, and then terminates the main thread.
The main queue will be served by a workload flow on demand from this point, like any other dispatch queue.
source share