Re: a segfault-handler?
- From: Drazen Kacar <dave arsdigita com>
- To: Helmethead <hoshem mel comcen com au>, Ronald Bultje <rbultje ronald bitfreak net>, gtk-list gnome org
- Subject: Re: a segfault-handler?
- Date: Tue, 10 Apr 2001 15:24:18 +0200
Helmethead wrote:
> Wow, three replies so far and noone says how to do it :)
>
> The answer is you can connect a callback to a signal with either the
> signal() (simplistic)
Be aware that the signal() function desn't behave in the same way on different
systems. Namely, after the signal handler is entered, some systems will
reset signal handler to SIG_DFL and some will not.
> or the sigaction() (sophisticated) system calls.
So you might have to use the sophisticated version. Systems which don't
have sigaction() usually have sigvec().
> Once you've finished doing everything in your handler, change the signal
You can't do everything in the signal handler. You may only call a small
set of functions which are async safe. You can't call malloc(), for
example. The usual way for dealing with signals is to set some global
variable (declared as volatile) in the signal handler and then to do
everything in the main code.
--
.-. .-. Sarcasm is just one more service we offer.
(_ \ / _)
| dave arsdigita com
|
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]