[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Do we have a signal handling class ? (was Re: How to handle CTRL+C)
From:       Waldo Bastian <bastian () kde ! org>
Date:       2001-07-27 23:28:23
[Download RAW message or body]

On Friday 27 July 2001 04:07 pm, Guillaume Laurent wrote:
> On Friday 27 July 2001 23:17, Waldo Bastian wrote:
> > I think we can map UNIX signals directly onto a Qt signal.
>
> What do you have in mind ? Signal handlers should typically do only very
> trivial things, as the paper explains.

static void kde_signal_handler(int sig)
{
  if (kapp)
    kapp->signal_handler(sig);
}

void KApplication::signal_handler(sig)
{
   emit UNIXsignal(sig); // Send away as Qt signal
}

The other option is to queue a message so that we can emit the signal from 
the Qt event loop. However, when you get a signal, you often need to respond 
more or less quickly, and that might not happen if you first need to wait for 
entering the event loop.

Note that KCrashHandler already catches UNIX signals for crash-recovery. E.g. 
kmail uses this to save the text from the composer to file upon a crash.

Cheers,
Waldo
-- 
Andrei Sakharov, Exiled 1980-1986, USSR, http://www.aip.org/history/sakharov/
Dmitry Sklyarov, Detained 2001-????, USA, http://www.elcomsoft.com/
 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic