Signals

From OSDev Wiki
Jump to: navigation, search

This article is a stub! This page or section is a stub. You can help the wiki by accurately contributing to it.

Signals are a Unix invention for asynchronous signaling, and were integrated into the C standard (<signal.h>). When a process receives a signal (send by hardware, or another process using raise()), a signal handler is called. A signal handler is a C function that handles the signal; which function to call on which signal is defined by passing its function pointer to the signal() function. (If no signal handler is defined for a given signal, a raise() of that signal aborts the program.)

Handling

Signal handling is tricky, since it breaks the single-control-flow structure of a C program. Not only that but in C, almost nothing is atomic, not even something like i++ (unless i is of type sig_atomic_t)---note that C11 adds more atomicity support. Make sure you read the manuals.

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
About
Toolbox