C Signal Slot Library
C Signal Slot Library, club ajedrez casino amistad numancia, poker skill level test, canberra gambling reform alliance. Sigslot, a signal-slot library. Sigslot is a header-only, thread safe implementation of signal-slots for C. The main goal was to replace Boost.Signals2. Apart from the usual features, it offers. Thread safety, Object lifetime tracking for automatic slot disconnection (extensible through ADL), RAII connection management.
C standard library |
---|
General topics |
Miscellaneous headers |
|
In the C Standard Library, signal processing defines how a program handles various signals while it executes. A signal can report some exceptional behavior within the program (such as division by zero), or a signal can report some asynchronous event outside the program (such as someone striking an interactive attention key on a keyboard).
Standard signals[edit]
The C standard defines only 6 signals. They are all defined in signal.h
header (csignal
header in C++):[1]
SIGABRT
- 'abort', abnormal termination.SIGFPE
- floating point exception.SIGILL
- 'illegal', invalid instruction.SIGINT
- 'interrupt', interactive attention request sent to the program.SIGSEGV
- 'segmentation violation', invalid memory access.SIGTERM
- 'terminate', termination request sent to the program.
Additional signals may be specified in the signal.h
header by the implementation. For example, Unix and Unix-like operating systems (such as Linux) define more than 15 additional signals; see Unix signal.[2]
Debugging[edit]
SIGTRAP
for debugging purposes. It's platform-dependent and may be used on Unix-like operating systems.
Handling[edit]
A signal can be generated by calling raise()
or kill()
system calls. raise()
sends a signal to the current process, kill()
sends a signal to a specific process.
A signal handler is a function which is called by the target environment when the corresponding signal occurs. The target environment suspends execution of the program until the signal handler returns or calls longjmp()
.
Signal handlers can be set be with signal()
or sigaction()
. The behavior of signal()
has been changed multiple times across history and is now considered deprecated.[3] It is only portable when used to set a signal's disposition to SIG_DFL or SIG_IGN. Signal handlers can be specified for all but two signals (SIGKILL and SIGSTOP cannot be caught, blocked or ignored).
If the signal reports an error within the program (and the signal is not asynchronous), the signal handler can terminate by calling abort()
, exit()
, or longjmp()
.
Functions[edit]
C++ Signal Slot
Function | Description |
---|---|
raise | artificially sends a signal to the calling process |
kill | artificially sends a signal to a specified process |
signal | sets the action taken when the program receives a specific signal |
Example usage[edit]
See also[edit]
References[edit]
- ^ISO/IEC 9899:1999 specification(PDF). p. 258, ยง 7.14 Signal handling.
- ^'The Open Group Base Specifications Issue 6 - signal.h - signals'. Retrieved 10 January 2012.
- ^http://man7.org/linux/man-pages/man2/signal.2.html Signal(2) manpage