Re: applicationShouldTerminate delegate does not work in Leopard
Re: applicationShouldTerminate delegate does not work in Leopard
- Subject: Re: applicationShouldTerminate delegate does not work in Leopard
- From: Jean-Daniel Dupas <email@hidden>
- Date: Thu, 17 Jan 2008 14:03:22 +0100
Le 17 janv. 08 à 13:45, Jens Miltner a écrit :
On 17.01.2008, at 12:54, Jean-Daniel Dupas wrote:
I'have just try with a background cocoa application on Leopard, and
the Activity Moniter call SIGINT. But you cannot do anything in a
signal handler, so it will not be helpfull.
static void sigtest(int arg) {
printf("%s\n", __func__);
}
signal(SIGINT, sigtest);
Well, you _can_ do some things in a signal handler (otherwise they
would be uterless unuseful ;-).
You could, e.g. set a flag or signal a semaphore - that's all within
the allowed APIs, IIRC.
You can't call any Cocoa functions directly, but you could have e.g.
a background thread block on a semaphore or mutex and signal/unlock
from the signal handler, then the background thread could perform a
selector on the main thread, etc.
Quite a bit jumping through hoops, but then again, if it's the only
option...
Yes, there is effectively many options, but they are rarely used
correctly. Just have a look at all those "How to catch crash" articles
on the web that extensively call Obj-C in signal handlers.
However, the OP meanwhile mentioned that no signals seem to be send
to the process, which seems a bit strange, as in my experience an
app is either send an appleevent or signalled...
Yes, and I have an application that run as a background application
(using plist keys, ...) and it effectively receives a SIGINT signal
(I'm running 10.5.1). So the problem is probably in the signal handler
installation, not in the OS.
_______________________________________________
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