aboutsummaryrefslogtreecommitdiff
path: root/src/event/ngx_event_timer.h
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-02-22 14:40:13 +0000
committerIgor Sysoev <igor@sysoev.ru>2005-02-22 14:40:13 +0000
commitd039a2e193c9172e4f415b9304222e81804a69d0 (patch)
tree4571d4da7950e9464e788a4d68dc5111167de52c /src/event/ngx_event_timer.h
parent174db74f2309e28c0e2b54e89b9e08afff187c7c (diff)
downloadnginx-d039a2e193c9172e4f415b9304222e81804a69d0.tar.gz
nginx-d039a2e193c9172e4f415b9304222e81804a69d0.zip
nginx-0.1.21-RELEASE importrelease-0.1.21
*) 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.
Diffstat (limited to 'src/event/ngx_event_timer.h')
-rw-r--r--src/event/ngx_event_timer.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/event/ngx_event_timer.h b/src/event/ngx_event_timer.h
index 090d4046a..edbfcf604 100644
--- 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 *ngx_event_timer_rbtree;
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_timer(ngx_event_t *ev)
}
-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_timer(ngx_event_t *ev, ngx_msec_t timer)
/*
* 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);