On 24-Jul-08, at 6:28 PM, Jean-Daniel Dupas wrote:


Once through your run loop is also a good place to hint to the collector that it should collect if necessary. A non-GC app would probably bracket the run of the run loop in an autorelease pool. A decent technique for this is to get the underlying CFRunLoop from the NSRunLoop (they're NOT toll-free bridged) and add an appropriate observer to it that gets callbacks at appropriate points.

(4) Use NSOperation for your work queue.

Since you're using Leopard, you can use NSOperation for your units of work. That will be easier than creating your own work queue system, and using OS-provided constructs like NSOperation can help the system better balance its overall load because it can take a holistic view that an app-implemented work queue can't.


Chris,

Excellent advice, and exactly what I was hoping for. Thanks.

I did a quick scan of your blog (I'll give it a more detailed read tomorrow at work), and one thing stood out immediately. Hanging out on the apple-cdsa mailing list, I found out that the preferred place to put daemon executables is in /Library/ PrivilegedHelperTools/ using an Authorization Services-enabled installer. There may be permissions issues in other locations (I'd originally tried to run my daemon from within the app package - strange things happened, e.g., when I tried to access keychain items). Apple has an example at:
<http://developer.apple.com/samplecode/BetterAuthorizationSample/>

Just an other advice if you go that way, be sure to choose an unique name for your daemon. /Library/PrivilegedHelperTools/ is for sure a good location, but if everybody puts its "Helper" executable into this folder, it may result into some name conflict.
A reverse dns name is probably a good choice.


And you launchd plist should be analogously named. For example:
        /Library/PrivilegedHelperTools/com.mycompany.mydaemond
        /Library/LaunchDaemons/com.mycompany.mydaemond.plist

----
Karl Moskowski <[EMAIL PROTECTED]>
Voodoo Ergonomics Inc. <http://voodooergonomics.com/>



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to