Separate watchdog & stats timer signals
This commit is contained in:
parent
2a49fb1c00
commit
c2bcf7691f
2 changed files with 8 additions and 2 deletions
|
|
@ -29,6 +29,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define PYFCGI_STATS_SZ (900)
|
#define PYFCGI_STATS_SZ (900)
|
||||||
|
#define PYFCGI_STATS_SIGALRM 30
|
||||||
|
|
||||||
typedef struct pyfcgi_stats_s pyfcgi_stats_t;
|
typedef struct pyfcgi_stats_s pyfcgi_stats_t;
|
||||||
typedef struct pyfcgi_stats_sample_s pyfcgi_stats_sample_t;
|
typedef struct pyfcgi_stats_sample_s pyfcgi_stats_sample_t;
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,15 @@ int pyfcgi_stats_init()
|
||||||
{
|
{
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
struct itimerspec timeout;
|
struct itimerspec timeout;
|
||||||
|
struct sigevent sev;
|
||||||
|
|
||||||
memset(&pyfcgi_stats, 0, sizeof(pyfcgi_stats_t));
|
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,
|
pyfcgi_log(LOG_ERR,
|
||||||
"Unable to create timer for stats collecting : %s",
|
"Unable to create timer for stats collecting : %s",
|
||||||
|
|
@ -27,7 +32,7 @@ int pyfcgi_stats_init()
|
||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
act.sa_flags = 0;
|
act.sa_flags = 0;
|
||||||
act.sa_restorer = NULL;
|
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,
|
pyfcgi_log(LOG_ERR,
|
||||||
"Unable to register signal handler for stats collecting : %s",
|
"Unable to register signal handler for stats collecting : %s",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue