osx - What happens if dispatch_main gets called from outside of the main thread? -


the dispatch_main function used make main thread start processing blocks dispatched main queue. so, dispatch_main kind of run loop, doesn't return and, after processing already-queued blocks, waits other blocks submitted main queue.

so, happens if dispatch_main gets called outside of main thread? if main thread processing function, interrupted in order allow main thread process queued blocks? allowed call dispatch_main outside of main thread?

dispatch_main() asserts when called outside of main thread , aborts process, must called main thread.

dispatch_main() nothing other pthread_exit() in disguise (see implementation): turns main queue ordinary serial dispatch queue , terminates main thread.

the main queue serviced on-demand workqueue thread point on, other dispatch queue.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -