Welcome! Log In Create A New Profile

Advanced

Re: Adding timer in nginx.c main

Maxim Dounin
January 12, 2015 01:24PM
Hello!

On Mon, Jan 12, 2015 at 11:34:12AM -0500, Nikhita wrote:

> Hi,
>
> I am adding a timer in nginx's main loop.....
>
> if (counter == -1) {
> ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "counter is null adding
> imer");
> /* Registring Timer */
> ngx_ipc_event.data = &dumb;
> ngx_ipc_event.handler = ngx_ipc_event_handler;
> ngx_ipc_event.log = cycle->log;
> if (!ngx_ipc_event.timer_set) {
> ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "Addding timer");
> ngx_add_timer(&ngx_ipc_event, 3000);
> }
> } else {
> ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "Counter is not null
> %d",counter);
> }
>
> static void
> ngx_ipc_event_handler(ngx_event_t *ev)
> {
> ngx_log_error(NGX_LOG_EMERG, ev->log, 0, "Invoked event handler");
> }
>
>
> My handler is not being triggered at all.......Although i get following logs
> in error.log
>
> 2015/01/12 21:56:48 [emerg] 22399#0: counter is null adding imer
> nginx: [emerg] counter is null adding imer
> 2015/01/12 21:56:48 [emerg] 22399#0: Addding timer
> nginx: [emerg] Addding timer

It looks like you are adding your timer to init cycle. This won't
work as the init cycle is only used to read a configuration file,
and destroyed afterwards.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Adding timer in nginx.c main

Nikhita January 12, 2015 11:34AM

Re: Adding timer in nginx.c main

Maxim Dounin January 12, 2015 01:24PM

Re: Adding timer in nginx.c main

Nikhita January 15, 2015 11:45AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 251
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready