[mareframe] Annotation of /trunk/gadget/interrupthandler.cc
Annotation of /trunk/gadget/interrupthandler.cc
Parent Directory
| Revision Log
Revision 17 -
(view)
(download)
1 : |
agomez |
1 |
#ifdef INTERRUPT_HANDLER
|
2 : |
|
|
|
3 : |
|
|
#include "interrupthandler.h" |
4 : |
|
|
#include "gadget.h" |
5 : |
|
|
|
6 : |
ulcessvp |
17 |
extern volatile int interrupted_print;
|
7 : |
agomez |
1 |
volatile int* irhInterrupted;
|
8 : |
|
|
|
9 : |
|
|
void registerInterrupts(volatile int* interrupted) {
|
10 : |
|
|
irhInterrupted = interrupted;
|
11 : |
|
|
struct sigaction act;
|
12 : |
|
|
sigemptyset(&act.sa_mask);
|
13 : |
|
|
sigaddset(&act.sa_mask, SIGINT);
|
14 : |
|
|
sigaddset(&act.sa_mask, SIGTSTP);
|
15 : |
|
|
act.sa_handler = interruptHandler;
|
16 : |
|
|
act.sa_flags = 0;
|
17 : |
|
|
sigaction(SIGINT, &act, 0);
|
18 : |
|
|
sigaction(SIGTSTP, &act, 0);
|
19 : |
|
|
}
|
20 : |
|
|
|
21 : |
|
|
void interruptHandler(int signal) {
|
22 : |
|
|
*irhInterrupted = 1;
|
23 : |
ulcessvp |
17 |
interrupted_print = 1;
|
24 : |
agomez |
1 |
}
|
25 : |
|
|
|
26 : |
|
|
#endif
|
|