21 lines
283 B
C++
21 lines
283 B
C++
|
#include <signal.h>
|
||
|
#include <stdio.h>
|
||
|
|
||
|
void handler(int)
|
||
|
{
|
||
|
puts("I'm a signal handler");
|
||
|
}
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
struct sigaction sa;
|
||
|
sa.sa_handler = handler;
|
||
|
sigaction(SIGABRT, &sa, NULL);
|
||
|
|
||
|
raise(SIGABRT);
|
||
|
|
||
|
puts("I'm outside the signal handler!");
|
||
|
|
||
|
return 0;
|
||
|
}
|