On Mon, Feb 25, 2013, at 02:45 PM, Steve Sisak wrote: > > The current trend is away from threads and toward asynchronous > programming. > > That's orthogonal to whether your tasks are run on a single > (XXRunLoop) or multiple (GCD) threads -- the advantage of GCD is that > the system gets do decide how many worker threads to fire up based on > the number of cores available, system load, and who's blocked.
They're orthogonal, but they don't compose well. 1. You cannot assume anything about the thread on which a block runs after being submitted to a GCD queue (other than the main queue). So no runloop-dependent technologies for you. That means you cannot call asynchronous Cocoa APIs from an async queue. 2. Blocking queues is _extremely_ dangerous, to the point where you mustn't do it. At best, you'll cause GCD to spin up extra worker threads unnecessarily. At worst, you'll cause deadlock as you exhaust your thread pool. This means you cannot call synchronous (blocking) Cocoa APIs from an async queue. Long story short: do not mix GCD queues and long-term communications APIs. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com