iphone - when something is run asynchronously does it mean that it's not on the main thread? -
i bit confused between concept of asynchronous loading , main thread. when loaded asynchronously, mean not run on main thread? far know 2 different concept, can run on main thread asynchronously , can run on background/secondary thread asynchronously. right me if wrong.
not quite. running asynchronously means doesn't stop execution continuing on current thread. of import difference because it's totally possible asynchronously such ends on main thread (for example: dispatch_async(dispatch_get_main_queue(), ^{ block });), mean it's not stopping some other thread continuing, blocking main thread.
because main thread of import applications, mutual use of asynchronous code avoid blocking it, it's not use.
(edited add)
it's more useful, perhaps, think of in terms of "async respect x". if this, example:
dispatch_async(aserialqueue, ^{ work(); work(); });
then 2 invocations of work synchronous respect each other, , synchronous respect other work on aserialqueue, asynchronous respect else.
iphone ios objective-c ipad
No comments:
Post a Comment