Accept cookies for analytics, social media, and advertising, or learn more and adjust your preferences. These cookies are on by default for visitors outside the UK and EEA. Privacy Notice.
ngx_add_timer
(ngx_event_t *ev, ngx_msec_t timer)¶NGINXイベントループにタイマーを追加します。通常ソケット上のタイムアウトのために使われますが、一般的なタイマーとしても使うことができます。
パラメータ: |
|
---|
例:
この例はダミーの接続を使って5秒後にタイマーイベントを引き起こすでしょう。
static ngx_event_t my_timer;
static ngx_connection_t dumb_con;
ngx_int_t ngx_my_init_process(ngx_cycle_t *cycle)
{
my_timer.handler = ngx_timer_fired;
my_timer.log = cycle->log;
my_timer.data = &dumb_con;
dumb.fd = (ngx_socket_t) -1;
}
void ngx_timer_fired(ngx_event_t *ev)
{
ngx_log_error(NGX_LOG_DEBUG, ev->log, 0, "Event fired!");
}
ngx_event_del_timer
(ngx_event_t *ev)¶NGINXイベントループからタイマーを削除する
パラメータ: |
|
---|