Re: Signal handling and Cocoa
Re: Signal handling and Cocoa
- Subject: Re: Signal handling and Cocoa
- From: email@hidden
- Date: Tue, 21 May 2002 15:22:04 -0700
Juha Pirttild wrote:
|1) I have a cross platform daemon that communicates with the GUI
|using shared memory. When the shared memory is changed, the
|daemon notifies the GUI by sending a SIGUSR1 to the GUI app.
|Similarly, when the GUI changes something in the shared mem, it
|notifies the daemon by sending a SIGUSR1.
|
|2) Daemon works well on MacOS X, it handles everything OK.
|However, if I do the following in my Cocoa incarnation of the
|GUI, and send it the SIGUSR1, it stops and complains (in PB)
|about receiving a SIGUSR1.
|
| [some code omitted]
|
|int main(int argc, const char *argv[])
|{
| signal(SIGUSR1,sig_DaemonMsg); // Register signal handler to
|notice the incoming msgs from the daemon
| return NSApplicationMain(argc, argv);
|}
|
|The signal handler is never called... instead I get a hang. I
|get a similar hang if I do not install a signal handler.
|
| ...
|
|So is this approach possible at all? What am I doing wrong? How
|should this be done?
My guess would be that NSApplicationMain (or something done while initializing NSApplication) is installing its own signal handlers, replacing yours. I'd try installing the handler in the applicationDidFinishLaunching: method of the application delegate. (See the NSApplication documentation for more on application delegates.)
Glen Fisher
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.