What is the main thread in GCD?
What exactly is the main thread in Grand Central Dispatch? Is it a thread created when the program starts up (maybe just before the main() function gets called), which is arbitrarily called "the main thread"? Or is it the program's main execution flow, which is always created for every running process? I think the first option is the right one, because it's not possible to send blocks to be executed by the program's main execution flow, I guess, unless this is done explicitly. So, the main thread in GCD must be another thread that is created to wait for blocks to be executed. Is it right?
GCD has no main thread unless running in the context of a CF/Foundation based process that has one of its own. If you use dispatch_main there's no main thread.
Every UI application on OS X has a main thread - it's where UI updates are (and must be) performed. GCD associates a queue with this thread, the main queue, and is also free to execute blocks from other queues on this thread though, in practice, it generally creates other threads for this purpose as it is generally considered inadvisable to block the main thread for any length of time (doing so brings up the dreaded SPOD, or spinning pizza of death, cursor).
Calling dispatch_main() also does not destroy or obviate the need for a main thread, it simply blocks it (which is why UI apps should use the run loop instead).