Re: How to get scripting to work without NSApplication
Re: How to get scripting to work without NSApplication
- Subject: Re: How to get scripting to work without NSApplication
- From: "Neal A. Crocker" <email@hidden>
- Date: Mon, 10 Dec 2001 11:06:37 -0800
Message: 7
Date: Sun, 9 Dec 2001 23:32:29 -0800
Subject: Re: How to get scripting to work without NSApplication
Cc: email@hidden
To: Scott Anguish <email@hidden>
From: Jason Bobier <email@hidden>
This is a background damon running as root. I only need to handle the
AEQuit event so that I can cleanup our sdk before the damon is
terminated.
If all you need is to catch a few appleevents directed at your app,
check out the Foundation Class NSAppleEventManager. Your programs
can use it to register handlers for specific appleevents. (The quit
event may be special in some way so this might not work. I'm not
sure.) Note that since it is Foundation, it is not dependent on the
existence of and NSApplication object.
Currently I am catching SIGTERM and doing the cleanup there. I was told
that this has issues though because cocoa can't handle being called from
signal handlers.
One thing that I did just notice though. NSNotificationCenter is
thread-safe and re-entrant. Does this mean that I could send a
notification to myself from a signal handler? If so, that would do the
job.
Thanx,
Jason