Mercurial > hg > nginx
comparison src/event/modules/ngx_rtsig_module.c @ 354:eaf1f651cf86
nginx-0.0.7-2004-06-15-11:55:11 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 15 Jun 2004 07:55:11 +0000 |
parents | 694d7ddc3599 |
children | 744ccb59062d |
comparison
equal
deleted
inserted
replaced
353:b8d3d7dbfcc8 | 354:eaf1f651cf86 |
---|---|
175 { | 175 { |
176 int signo; | 176 int signo; |
177 ngx_rtsig_conf_t *rtscf; | 177 ngx_rtsig_conf_t *rtscf; |
178 | 178 |
179 if (c->read->accept && c->read->disabled) { | 179 if (c->read->accept && c->read->disabled) { |
180 | |
181 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
182 "rtsig enable connection: fd:%d", c->fd); | |
183 | |
180 if (fcntl(c->fd, F_SETOWN, ngx_pid) == -1) { | 184 if (fcntl(c->fd, F_SETOWN, ngx_pid) == -1) { |
181 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, | 185 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, |
182 "fcntl(F_SETOWN) failed"); | 186 "fcntl(F_SETOWN) failed"); |
183 return NGX_ERROR; | 187 return NGX_ERROR; |
184 } | 188 } |
231 { | 235 { |
232 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, | 236 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
233 "rtsig del connection: fd:%d", c->fd); | 237 "rtsig del connection: fd:%d", c->fd); |
234 | 238 |
235 if ((flags & NGX_DISABLE_EVENT) && c->read->accept) { | 239 if ((flags & NGX_DISABLE_EVENT) && c->read->accept) { |
240 | |
241 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
242 "rtsig disable connection: fd:%d", c->fd); | |
243 | |
236 c->read->active = 0; | 244 c->read->active = 0; |
237 c->read->disabled = 0; | 245 c->read->disabled = 1; |
238 return NGX_OK; | 246 return NGX_OK; |
239 } | 247 } |
240 | 248 |
241 if (flags & NGX_CLOSE_EVENT) { | 249 if (flags & NGX_CLOSE_EVENT) { |
242 c->read->active = 0; | 250 c->read->active = 0; |
243 c->write->active = 0; | 251 c->write->active = 0; |
252 c->read->posted = 0; | |
253 c->write->posted = 0; | |
244 return NGX_OK; | 254 return NGX_OK; |
245 } | 255 } |
246 | 256 |
247 if (fcntl(c->fd, F_SETFL, O_RDWR|O_NONBLOCK) == -1) { | 257 if (fcntl(c->fd, F_SETFL, O_RDWR|O_NONBLOCK) == -1) { |
248 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, | 258 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, |
250 return NGX_ERROR; | 260 return NGX_ERROR; |
251 } | 261 } |
252 | 262 |
253 c->read->active = 0; | 263 c->read->active = 0; |
254 c->write->active = 0; | 264 c->write->active = 0; |
265 c->read->posted = 0; | |
266 c->write->posted = 0; | |
255 | 267 |
256 return NGX_OK; | 268 return NGX_OK; |
257 } | 269 } |
258 | 270 |
259 | 271 |
297 if (ngx_accept_mutex) { | 309 if (ngx_accept_mutex) { |
298 if (ngx_accept_disabled > 0) { | 310 if (ngx_accept_disabled > 0) { |
299 ngx_accept_disabled--; | 311 ngx_accept_disabled--; |
300 | 312 |
301 } else { | 313 } else { |
314 ngx_accept_mutex_held = 0; | |
315 | |
302 if (ngx_trylock_accept_mutex(cycle) == NGX_ERROR) { | 316 if (ngx_trylock_accept_mutex(cycle) == NGX_ERROR) { |
303 return NGX_ERROR; | 317 return NGX_ERROR; |
304 } | 318 } |
305 | 319 |
306 if (ngx_accept_mutex_held == 0 | 320 if (ngx_accept_mutex_held == 0 |
515 | 529 |
516 /* TODO: old cylces */ | 530 /* TODO: old cylces */ |
517 | 531 |
518 static ngx_int_t ngx_rtsig_process_overflow(ngx_cycle_t *cycle) | 532 static ngx_int_t ngx_rtsig_process_overflow(ngx_cycle_t *cycle) |
519 { | 533 { |
520 int name[2], len, rtsig_max, rtsig_nr, events, ready; | 534 int name[2], rtsig_max, rtsig_nr, events, ready; |
535 size_t len; | |
521 ngx_int_t tested, n, i; | 536 ngx_int_t tested, n, i; |
522 ngx_err_t err; | 537 ngx_err_t err; |
523 ngx_connection_t *c; | 538 ngx_connection_t *c; |
524 ngx_rtsig_conf_t *rtscf; | 539 ngx_rtsig_conf_t *rtscf; |
525 | 540 |
707 | 722 |
708 /* LinuxThreads use the first 3 RT signals */ | 723 /* LinuxThreads use the first 3 RT signals */ |
709 ngx_conf_init_value(rtscf->signo, SIGRTMIN + 10); | 724 ngx_conf_init_value(rtscf->signo, SIGRTMIN + 10); |
710 | 725 |
711 ngx_conf_init_value(rtscf->overflow_events, 16); | 726 ngx_conf_init_value(rtscf->overflow_events, 16); |
712 ngx_conf_init_value(rtscf->overflow_test, 100); | 727 ngx_conf_init_value(rtscf->overflow_test, 32); |
713 ngx_conf_init_value(rtscf->overflow_threshold, 4); | 728 ngx_conf_init_value(rtscf->overflow_threshold, 10); |
714 | 729 |
715 return NGX_CONF_OK; | 730 return NGX_CONF_OK; |
716 } | 731 } |