Cirrus Logic CS485 Manual de usuario Pagina 45

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 67
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 44
CS485G Spring 2015 45
(a) Terminate
(b) Ignore
(c) Terminate and create a dump file (called core).
(d) Temporarily stop the process.
(e) Continue the process from a temporary stop.
(f) Catch the signal by installing a procedure in the process called
a signal handler.
(g) Temporarily block the signal (the signal becomes pending; fur-
ther identical signals are ignored while it is pending).
(h) Unblock a pending signal
9. When a signal handler runs, the process is temporarily interrupted;
it resumes when the signal handler finishes.
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <signal.h>
4 void handler(int sig) {
5 safe_printf("You hit ctrl-c\n");
6 sleep(2);
7 safe_printf("Well...");
8 sleep(1);
9 printf("OK\n");
10 exit(0);
11 }
12 main() {
13 signal(SIGINT, handler); /
*
install handler
*
/
14 while(1) { // busy loop
15 }
16 }
10. If an arriving signal interrupts a long system call (such as read()),
different versions of Unix have different behaviors when the signal
handler finishes: Continue the long system call (Linux), abort the
long system call with an EINTER error.
11. A function is async-signal-safe if all its variables are local (so it is
reentrant) or non-interruptible.
(a) Such functions may be called even from inside a handler.
Vista de pagina 44
1 2 ... 40 41 42 43 44 45 46 47 48 49 50 ... 66 67

Comentarios a estos manuales

Sin comentarios