Mercurial > hg > nginx-quic
comparison src/event/ngx_event.c @ 306:6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 04 Apr 2004 20:32:09 +0000 |
parents | 4b1a3a4acc60 |
children | ce375c313e96 |
comparison
equal
deleted
inserted
replaced
305:4b1a3a4acc60 | 306:6b91bfbc4123 |
---|---|
47 | 47 |
48 | 48 |
49 ngx_atomic_t *ngx_accept_mutex_ptr; | 49 ngx_atomic_t *ngx_accept_mutex_ptr; |
50 ngx_atomic_t *ngx_accept_mutex; | 50 ngx_atomic_t *ngx_accept_mutex; |
51 ngx_uint_t ngx_accept_mutex_held; | 51 ngx_uint_t ngx_accept_mutex_held; |
52 | 52 ngx_msec_t ngx_accept_mutex_delay; |
53 | 53 |
54 ngx_thread_volatile ngx_event_t *ngx_posted_events; | |
55 #if (NGX_THREADS) | |
56 ngx_mutex_t *ngx_posted_events_mutex; | |
57 #endif | |
58 | 54 |
59 | 55 |
60 static ngx_str_t events_name = ngx_string("events"); | 56 static ngx_str_t events_name = ngx_string("events"); |
61 | 57 |
62 static ngx_command_t ngx_events_commands[] = { | 58 static ngx_command_t ngx_events_commands[] = { |
110 { ngx_string("accept_mutex"), | 106 { ngx_string("accept_mutex"), |
111 NGX_EVENT_CONF|NGX_CONF_TAKE1, | 107 NGX_EVENT_CONF|NGX_CONF_TAKE1, |
112 ngx_conf_set_flag_slot, | 108 ngx_conf_set_flag_slot, |
113 0, | 109 0, |
114 offsetof(ngx_event_conf_t, accept_mutex), | 110 offsetof(ngx_event_conf_t, accept_mutex), |
111 NULL }, | |
112 | |
113 { ngx_string("accept_mutex_delay"), | |
114 NGX_EVENT_CONF|NGX_CONF_TAKE1, | |
115 ngx_conf_set_msec_slot, | |
116 0, | |
117 offsetof(ngx_event_conf_t, accept_mutex_delay), | |
115 NULL }, | 118 NULL }, |
116 | 119 |
117 ngx_null_command | 120 ngx_null_command |
118 }; | 121 }; |
119 | 122 |
184 ngx_iocp_conf_t *iocpcf; | 187 ngx_iocp_conf_t *iocpcf; |
185 #endif | 188 #endif |
186 | 189 |
187 | 190 |
188 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); | 191 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); |
192 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); | |
189 | 193 |
190 if (ccf->worker_processes > 1 && ngx_accept_mutex_ptr) { | 194 if (ccf->worker_processes > 1 && ngx_accept_mutex_ptr) { |
191 ngx_accept_mutex = ngx_accept_mutex_ptr; | 195 ngx_accept_mutex = ngx_accept_mutex_ptr; |
192 ngx_accept_mutex_held = 1; | 196 ngx_accept_mutex_held = 1; |
197 ngx_accept_mutex_delay = ecf->accept_mutex_delay; | |
193 } | 198 } |
194 | 199 |
195 #if (NGX_THREADS) | 200 #if (NGX_THREADS) |
196 if (!(ngx_posted_events_mutex = ngx_mutex_init(cycle->log, 0))) { | 201 if (!(ngx_posted_events_mutex = ngx_mutex_init(cycle->log, 0))) { |
197 return NGX_ERROR; | 202 return NGX_ERROR; |
199 #endif | 204 #endif |
200 | 205 |
201 if (ngx_event_timer_init(cycle->log) == NGX_ERROR) { | 206 if (ngx_event_timer_init(cycle->log) == NGX_ERROR) { |
202 return NGX_ERROR; | 207 return NGX_ERROR; |
203 } | 208 } |
204 | |
205 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); | |
206 | 209 |
207 cycle->connection_n = ecf->connections; | 210 cycle->connection_n = ecf->connections; |
208 | 211 |
209 for (m = 0; ngx_modules[m]; m++) { | 212 for (m = 0; ngx_modules[m]; m++) { |
210 if (ngx_modules[m]->type != NGX_EVENT_MODULE) { | 213 if (ngx_modules[m]->type != NGX_EVENT_MODULE) { |
523 | 526 |
524 ecf->connections = NGX_CONF_UNSET; | 527 ecf->connections = NGX_CONF_UNSET; |
525 ecf->use = NGX_CONF_UNSET; | 528 ecf->use = NGX_CONF_UNSET; |
526 ecf->multi_accept = NGX_CONF_UNSET; | 529 ecf->multi_accept = NGX_CONF_UNSET; |
527 ecf->accept_mutex = NGX_CONF_UNSET; | 530 ecf->accept_mutex = NGX_CONF_UNSET; |
531 ecf->accept_mutex_delay = NGX_CONF_UNSET_MSEC; | |
528 ecf->name = (void *) NGX_CONF_UNSET; | 532 ecf->name = (void *) NGX_CONF_UNSET; |
529 | 533 |
530 return ecf; | 534 return ecf; |
531 } | 535 } |
532 | 536 |
596 | 600 |
597 cycle->connection_n = ecf->connections; | 601 cycle->connection_n = ecf->connections; |
598 | 602 |
599 ngx_conf_init_value(ecf->multi_accept, 0); | 603 ngx_conf_init_value(ecf->multi_accept, 0); |
600 ngx_conf_init_value(ecf->accept_mutex, 1); | 604 ngx_conf_init_value(ecf->accept_mutex, 1); |
605 ngx_conf_init_msec_value(ecf->accept_mutex_delay, 500); | |
601 | 606 |
602 return NGX_CONF_OK; | 607 return NGX_CONF_OK; |
603 } | 608 } |