Hello,

When implementing the while-loop in the main function of an NSThread, is it correct to assume it is more efficient on the operating system to run the current run-loop until a specified date rather than just use NSThread sleepUntilDate to obtain the delay? I ask because I don't really need a formal run loop or special input source as I'm just checking a shared queue for data (and the delay is to allow the thread to gracefully exit). So it's simpler to code just the NSThread sleep, however, I am guessing that will cause me context switching performance issues and I'd be better off using the NSRunLoop?

Finally, is it acceptable to use the NSThread's cancelled/isCancelled mechanism to check for the thread-exit hint, rather than set/check a global variable in the NSThread threadDictionary (as Apple's documentation shows)?

Thank You,
- Eric


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to