Mercurial > hg > nginx-quic
diff src/event/ngx_event_timer.h @ 493:975f62e77f02 release-0.1.21
nginx-0.1.21-RELEASE import
*) Bugfix: the ngx_http_stub_status_module showed incorrect statistics
if "rtsig" method was used or if several worker process ran on SMP.
*) Bugfix: nginx could not be built by the icc compiler on Linux or if
the zlib-1.2.x library was building from sources.
*) Bugfix: nginx could not be built on NetBSD 2.0.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 22 Feb 2005 14:40:13 +0000 |
parents | bbd6b0b4a2b1 |
children | d4ea69372b94 |
line wrap: on
line diff
--- a/src/event/ngx_event_timer.h +++ b/src/event/ngx_event_timer.h @@ -16,8 +16,9 @@ #define NGX_TIMER_INFINITE -1 #define NGX_TIMER_ERROR -2 + /* - * 32 bit timer key value resolution + * the 32-bit timer key value resolution * * 1 msec - 24 days * 10 msec - 8 months @@ -27,6 +28,8 @@ #define NGX_TIMER_RESOLUTION 1 +#define NGX_TIMER_LAZY_DELAY 300 + ngx_int_t ngx_event_timer_init(ngx_log_t *log); ngx_msec_t ngx_event_find_timer(void); @@ -42,7 +45,8 @@ extern ngx_thread_volatile ngx_rbtree_t extern ngx_rbtree_t ngx_event_timer_sentinel; -static ngx_inline void ngx_event_del_timer(ngx_event_t *ev) +static ngx_inline void +ngx_event_del_timer(ngx_event_t *ev) { ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, "event timer del: %d: %d", @@ -68,7 +72,8 @@ static ngx_inline void ngx_event_del_tim } -static ngx_inline void ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer) +static ngx_inline void +ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer) { ngx_int_t key; @@ -83,11 +88,13 @@ static ngx_inline void ngx_event_add_tim /* * Use the previous timer value if a difference between them is less - * then 100 milliseconds. It allows to minimize the rbtree operations - * for the fast connections. + * then NGX_TIMER_LAZY_DELAY milliseconds. It allows to minimize + * the rbtree operations for the fast connections. */ - if (abs(key - ev->rbtree_key) < 100 / NGX_TIMER_RESOLUTION) { + if (abs(key - ev->rbtree_key) + < NGX_TIMER_LAZY_DELAY / NGX_TIMER_RESOLUTION) + { ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0, "event timer: %d, old: %i, new: %i", ngx_event_ident(ev->data), ev->rbtree_key, key);