comparison src/event/ngx_event_timer.c @ 112:408f195b3482 NGINX_0_3_3

nginx 0.3.3 *) Change: the "bl" and "af" parameters of the "listen" directive was renamed to the "backlog" and "accept_filter". *) Feature: the "rcvbuf" and "sndbuf" parameters of the "listen" directive. *) Change: the "$msec" log parameter does not require now the additional the gettimeofday() system call. *) Feature: the -t switch now tests the "listen" directives. *) Bugfix: if the invalid address was specified in the "listen" directive, then after the -HUP signal nginx left an open socket in the CLOSED state. *) Bugfix: the mime type may be incorrectly set to default value for index file with variable in the name; bug appeared in 0.3.0. *) Feature: the "timer_resolution" directive. *) Feature: the millisecond "$upstream_response_time" log parameter. *) Bugfix: a temporary file with client request body now is removed just after the response header was transferred to a client. *) Bugfix: OpenSSL 0.9.6 compatibility. *) Bugfix: the SSL certificate and key file paths could not be relative. *) Bugfix: the "ssl_prefer_server_ciphers" directive did not work in the ngx_imap_ssl_module. *) Bugfix: the "ssl_protocols" directive allowed to specify the single protocol only.
author Igor Sysoev <http://sysoev.ru>
date Wed, 19 Oct 2005 00:00:00 +0400
parents dad2fe8ecf08
children 6ae1357b7b7c
comparison
equal deleted inserted replaced
111:a175b609c76d 112:408f195b3482
50 50
51 if (ngx_event_timer_rbtree.root == &ngx_event_timer_sentinel) { 51 if (ngx_event_timer_rbtree.root == &ngx_event_timer_sentinel) {
52 return NGX_TIMER_INFINITE; 52 return NGX_TIMER_INFINITE;
53 } 53 }
54 54
55 if (ngx_mutex_lock(ngx_event_timer_mutex) == NGX_ERROR) { 55 ngx_mutex_lock(ngx_event_timer_mutex);
56 return NGX_TIMER_ERROR;
57 }
58 56
59 root = ngx_event_timer_rbtree.root; 57 root = ngx_event_timer_rbtree.root;
60 sentinel = ngx_event_timer_rbtree.sentinel; 58 sentinel = ngx_event_timer_rbtree.sentinel;
61 59
62 node = ngx_rbtree_min(root, sentinel); 60 node = ngx_rbtree_min(root, sentinel);
63 61
64 ngx_mutex_unlock(ngx_event_timer_mutex); 62 ngx_mutex_unlock(ngx_event_timer_mutex);
65 63
66 timer = (ngx_msec_int_t) node->key - (ngx_msec_int_t) ngx_current_time; 64 timer = (ngx_msec_int_t) node->key - (ngx_msec_int_t) ngx_current_msec;
67 65
68 return (ngx_msec_t) (timer > 0 ? timer : 0); 66 return (ngx_msec_t) (timer > 0 ? timer : 0);
69 } 67 }
70 68
71 69
77 75
78 sentinel = ngx_event_timer_rbtree.sentinel; 76 sentinel = ngx_event_timer_rbtree.sentinel;
79 77
80 for ( ;; ) { 78 for ( ;; ) {
81 79
82 if (ngx_mutex_lock(ngx_event_timer_mutex) == NGX_ERROR) { 80 ngx_mutex_lock(ngx_event_timer_mutex);
83 return;
84 }
85 81
86 root = ngx_event_timer_rbtree.root; 82 root = ngx_event_timer_rbtree.root;
87 83
88 if (root == sentinel) { 84 if (root == sentinel) {
89 return; 85 return;
91 87
92 node = ngx_rbtree_min(root, sentinel); 88 node = ngx_rbtree_min(root, sentinel);
93 89
94 /* node->key <= ngx_current_time */ 90 /* node->key <= ngx_current_time */
95 91
96 if ((ngx_msec_int_t) node->key - (ngx_msec_int_t) ngx_current_time <= 0) 92 if ((ngx_msec_int_t) node->key - (ngx_msec_int_t) ngx_current_msec <= 0)
97 { 93 {
98 ev = (ngx_event_t *) ((char *) node - offsetof(ngx_event_t, timer)); 94 ev = (ngx_event_t *) ((char *) node - offsetof(ngx_event_t, timer));
99 95
100 #if (NGX_THREADS) 96 #if (NGX_THREADS)
101 97
131 127
132 ev->timer_set = 0; 128 ev->timer_set = 0;
133 129
134 #if (NGX_THREADS) 130 #if (NGX_THREADS)
135 if (ngx_threaded) { 131 if (ngx_threaded) {
136 if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_ERROR) { 132 ev->posted_timedout = 1;
137 return;
138 }
139 133
140 ev->posted_timedout = 1; 134 ngx_post_event(ev, &ngx_posted_events);
141 ngx_post_event(ev);
142
143 ngx_mutex_unlock(ngx_posted_events_mutex);
144 135
145 ngx_unlock(ev->lock); 136 ngx_unlock(ev->lock);
146 137
147 continue; 138 continue;
148 } 139 }