2003-01-24 02:47:54 +08:00
|
|
|
#ifndef _NGX_EVENT_TIMER_H_INCLUDED_
|
|
|
|
#define _NGX_EVENT_TIMER_H_INCLUDED_
|
|
|
|
|
|
|
|
|
|
|
|
#include <ngx_config.h>
|
2003-06-11 23:28:34 +08:00
|
|
|
#include <ngx_core.h>
|
2003-01-24 02:47:54 +08:00
|
|
|
#include <ngx_event.h>
|
|
|
|
|
|
|
|
|
2003-07-04 23:10:33 +08:00
|
|
|
int ngx_event_timer_init(ngx_cycle_t *cycle);
|
|
|
|
void ngx_event_timer_done(ngx_cycle_t *cycle);
|
2003-01-24 02:47:54 +08:00
|
|
|
void ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer);
|
2003-05-20 00:39:14 +08:00
|
|
|
int ngx_event_find_timer(void);
|
2003-11-26 04:44:56 +08:00
|
|
|
void ngx_event_set_timer_delta(ngx_msec_t timer);
|
2003-01-27 05:08:14 +08:00
|
|
|
void ngx_event_expire_timers(ngx_msec_t timer);
|
2003-01-24 02:47:54 +08:00
|
|
|
|
2003-01-24 14:20:47 +08:00
|
|
|
|
2003-01-24 02:47:54 +08:00
|
|
|
|
|
|
|
ngx_inline static void ngx_event_del_timer(ngx_event_t *ev)
|
|
|
|
{
|
|
|
|
#if (NGX_DEBUG_EVENT)
|
2003-06-11 23:28:34 +08:00
|
|
|
ngx_connection_t *c = ev->data;
|
2003-10-13 00:49:16 +08:00
|
|
|
ngx_log_debug(ev->log, "del timer: %d:%d" _ c->fd _ ev->write);
|
2003-01-24 02:47:54 +08:00
|
|
|
#endif
|
|
|
|
|
2003-05-15 23:42:53 +08:00
|
|
|
if (!ev->timer_next || !ev->timer_prev) {
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, ev->log, 0, "timer already deleted");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-01-24 02:47:54 +08:00
|
|
|
if (ev->timer_prev) {
|
|
|
|
ev->timer_prev->timer_next = ev->timer_next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ev->timer_next) {
|
|
|
|
ev->timer_next->timer_delta += ev->timer_delta;
|
|
|
|
ev->timer_next->timer_prev = ev->timer_prev;
|
|
|
|
ev->timer_next = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ev->timer_prev) {
|
|
|
|
ev->timer_prev = NULL;
|
|
|
|
}
|
2003-10-13 00:49:16 +08:00
|
|
|
|
|
|
|
ev->timer_set = 0;
|
2003-01-24 02:47:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-07 01:21:13 +08:00
|
|
|
#endif /* _NGX_EVENT_TIMER_H_INCLUDED_ */
|