site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Hello List, I am using two daemons for my application to use. One of these daemon is using Quartz API. Consider Daemon1 & Daemon2 , In which Daemon2 is Using Quartz API. Daemon2 can't be launch before login. So I am trying to launch it from Daemon1. while(true) { CFMachPortRef port = CGWindowServerCFMachPort(); if(port != NULL) { system("launchctl load /Library/LaunchDaemons/Daemon2.plist"); system("launchctl start Daemon2"); CFRelease(port); break; } } _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com On May 15, 2009, at 10:38 AM, Susan Granger wrote: By using the code snippet below Daemon2 crashed throwing some Untrusted Apps can't..... I reached to the conclusion that Daemon2 need to launch after user crossed the login window. Sitting in Daemon1 how can I get notification that a user has logged in? Firstly, system daemons should not be drawing UI or otherwise attempting to directly manipulate a user's session. Treat these operations as things to be done within the context of a user with an agent. Secondly, your daemon should advertise some sort of launch on-demand criteria so that you can just write bytes to a socket or send a Mach message and have launchd kick it off for you. Manually loading and unloading jobs should be considered as a last resort hack for when launchd doesn't currently provide you with the flexibility you need to describe your job's life cycle. Thirdly, busy-waiting in a system daemon needlessly consumes resources at boot. Please avoid doing that. Fourth, daemons should only be used for privileged operations. Why do you believe you need two system daemons to interact with Quartz? -- Damien Sorresso BSD Engineering Apple Inc. smime.p7s