[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Signal handling

Signals are invoked, or raised, using the raise() function. When a signal is raised its associated function is executed.
With the Metrowerks C implementation of signal.h a signal can only be invoked through the function "raise", and, in the case of the SIGABRT signal, through the function "abort". When a signal is raised, its signal handling function is executed as a normal function call.
The default signal handler for all signals except SIGTERM is SIG_DFL. The SIG_DFL function aborts a program with the abort() function, while the SIGTERM signal terminates a program normally with the exit() function.
The ANSI C Standard Library specifies that the SIG prefix used by the signal.h macros is reserved for future use. The programmer should avoid using the prefix to prevent conflicts with future specifications of the Standard Library.
The type typedef char sig_atomic_t in signal.h can be accessed as an incorruptible, atomic entity during an asynchronous interrupt.
The number of signals is defined by __signal_max given a value in this header.
Warning: Using unprotected re-entrant functions such as printf(), getchar(), malloc(), etc. functions from within a signal handler is not recommended in any system that can throw signals in hardware. Signals are in effect interrupts, and can happen anywhere, including when you're already within a function. Even functions that protect themselves from re-entry in a multi-threaded case can fail if you re-enter them from a signal handler.
signal.h Signal descriptions:
The signal() function specifies how a signal is handled: a signal can be ignored, handled in a default manner, or be handled by a programmer-supplied signal handling function. "Signal function handling arguments" describes the pre-defined signal handling macros.
Signal function handling arguments:
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000