SHARE
TWEET

Untitled

a guest May 23rd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <signal.h>
  4.  
  5. #define RING '\a'
  6.  
  7. int count = 0;
  8.  
  9. void processSignal(int Signal)
  10. {
  11.     if (Signal == SIGQUIT)//дамп памяти
  12.     {
  13.         printf("Count of DELETE tapping: %d\n", count);
  14.         exit(EXIT_SUCCESS);
  15.     }
  16.  
  17.     printf("%c\n", RING);
  18.     count++;
  19. }
  20. int main()
  21. {
  22.     if (sigset(SIGINT, processSignal) == SIG_ERR)//небезопасен для многопоточных, устарел
  23.     {
  24.         perror("Signal SIGINT setting error");
  25.         exit(EXIT_FAILURE);
  26.     }
  27.     if (signal(SIGQUIT, processSignal) == SIG_ERR)
  28.     {
  29.         perror("Signal SIGQUIT setting error");
  30.         exit(EXIT_FAILURE);
  31.     }
  32.     for (;;);
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top