Separate watchdog & stats timer signals

This commit is contained in:
Yann Weber 2019-08-11 16:47:29 +02:00
commit c2bcf7691f
2 changed files with 8 additions and 2 deletions

View file

@ -29,6 +29,7 @@
#include <string.h>
#define PYFCGI_STATS_SZ (900)
#define PYFCGI_STATS_SIGALRM 30
typedef struct pyfcgi_stats_s pyfcgi_stats_t;
typedef struct pyfcgi_stats_sample_s pyfcgi_stats_sample_t;

View file

@ -12,10 +12,15 @@ int pyfcgi_stats_init()
{
struct sigaction act;
struct itimerspec timeout;
struct sigevent sev;
memset(&pyfcgi_stats, 0, sizeof(pyfcgi_stats_t));
if(timer_create(CLOCK_REALTIME, NULL, &(pyfcgi_stats.timerid)) < 0)
sev.sigev_notify = SIGEV_SIGNAL;
sev.sigev_signo = PYFCGI_STATS_SIGALRM;
sev.sigev_value.sival_int = 0;
if(timer_create(CLOCK_REALTIME, &sev, &(pyfcgi_stats.timerid)) < 0)
{
pyfcgi_log(LOG_ERR,
"Unable to create timer for stats collecting : %s",
@ -27,7 +32,7 @@ int pyfcgi_stats_init()
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
act.sa_restorer = NULL;
if(sigaction(SIGALRM, &act, &(pyfcgi_stats.oldact)) < 0)
if(sigaction(PYFCGI_STATS_SIGALRM, &act, &(pyfcgi_stats.oldact)) < 0)
{
pyfcgi_log(LOG_ERR,
"Unable to register signal handler for stats collecting : %s",