On Jun 4, 2014, at 14:45 , Alex Zavatone <z...@mac.com> wrote:

> But I need to come up with an explanation of explain why that is a bad idea 
> and why it smells

It smells because a computationally intensive while loop will stall the 
dispatch queue that’s stuck on it.

If you’re programming with *threads*, it’s fine to dedicate a thread to a 
long-running operation.

If you’re programming with *dispatch queues*, you’re sharing a resource (a CPU) 
with other applications. Taking the resource over for yourself is detrimental 
to overall system performance.

Breaking the long task into smaller pieces allows the pieces to be distributed 
over as many threads as the OS wants to use, and doesn’t deny access to CPUs to 
other threads and processes.

_______________________________________________

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

Reply via email to