LCOV - code coverage report
Current view: top level - src - notify_quit_handler.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 13 0
Test Date: 2026-01-12 05:34:38 Functions: 0.0 % 1 0

            Line data    Source code
       1              : #include "precizer.h"
       2              : 
       3              : /**
       4              :  *
       5              :  * Interrupt loops smoothly
       6              :  * Interrupt when Ctrl+C (SIGTERM) or
       7              :  * kill -15 (SIGINT)
       8              :  *
       9              :  */
      10            0 : void notify_quit_handler(int sig)
      11              : {
      12            0 :         slog(EVERY,"Notify quit!\n");
      13              : 
      14            0 :         atomic_store(&global_interrupt_flag,true);
      15              : 
      16            0 :         atomic_store(&global_return_status,HALTED);
      17              : 
      18            0 :         slog(EVERY,"The global return status and exit flag has been set to %s\n",show_status(global_return_status));
      19              : 
      20            0 :         if(sig==SIGTERM)
      21              :         {
      22            0 :                 slog(EVERY,"Terminating the application. Please wait while the database will be closed smoothly…\n");
      23              :         }
      24              : 
      25            0 :         if(sig==SIGINT)
      26              :         {
      27            0 :                 slog(EVERY,"Interrupting the application. Please wait while the database will be closed smoothly…\n");
      28              :         }
      29              : 
      30              :         /// Enable key echo in terminal
      31              :         struct termios term;
      32            0 :         tcgetattr(fileno(stdin),&term);
      33            0 :         term.c_lflag |= (ICANON|ECHO);
      34            0 :         tcsetattr(fileno(stdin),0,&term);
      35            0 : }
        

Generated by: LCOV version 2.0-1