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: "parag vibhute" <email@hidden>
- Date: Thu, 17 Jan 2008 19:04:54 +0530
This is to inform to those guys that who will/are struggle for this problem:
1. On Panther & Leopard, when u quit background process from activity
monitor, "applicationshouldterminate" delegate gets called.
2. On Leopard, when u quit background process from activity monitor,
"applicationshouldterminate" delegate does not get called but you can catch
SIGINT singal. So write SIGINT handler.
3. On Panther & Leopard, when u quit background process from activity
monitor, you can not catch SIGINT signal. So only way to catch it is use
"applicationshouldterminate" method.
Now my next thing will be to find macros for each OS which will execute OS
dependant code.
Thanks,
Palav
On Jan 17, 2008 6:45 PM, parag vibhute <email@hidden> wrote:
> Hi Jean,
>
> I tried signal handling on Panther, Tiger & Leopard. But found that on
> Panther & Tiger, it did not work & only worked on Leopard which is strange.
> Is that the only solution?
>
> Thanks,
> palav
>
>
> On Jan 17, 2008 6:33 PM, Jean-Daniel Dupas <email@hidden> wrote:
>
> >
> > 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
> >
>
>
>
> --
>
> There are many things in your life that will catch your eye but only a few
> will catch your heart....pursue those'.
>
--
There are many things in your life that will catch your eye but only a few
will catch your heart....pursue those'.
_______________________________________________
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