Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to yield a thread in Carbon these days?



OIC you are correct, i thought you were doing a lenghy calculation, not waiting, sorry i misread. yes if you're just waiting, doing no work, then MPYield or some such is certainly called for.


On May 23, 2008, at 11:42 PM, Uli Kusterer wrote:

Am 24.05.2008 um 08:03 schrieb David M. Cotter:
then again, there really is no need at all to "yield" on a preemptive thread. loop away doing your calculation, the process manager makes sure you don't starve other threads.

yielding is only an issue on cooperative threads

Well, not quite true. If you're spinning in a busy loop, you're eating more CPU cycles than you'd need to. Most other APIs take a delay for how long you want your thread to sleep, which means the scheduler can do a much better job because it knows your thread won't need cycles until that time has gone by.


In a busy loop, you'll get the maximum number of cycles the scheduler can give you, and that means you'll be eating battery time on Notebook computers like mad.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."




_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: How to yield a thread in Carbon these days? (From: Scott Ribe <email@hidden>)
 >Re: How to yield a thread in Carbon these days? (From: "David M. Cotter" <email@hidden>)
 >Re: How to yield a thread in Carbon these days? (From: Uli Kusterer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.