Re: Daemon Advice?
Re: Daemon Advice?
- Subject: Re: Daemon Advice?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Fri, 25 Jul 2008 00:28:41 +0200
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.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden