nginxtra 1.6.3.9 → 1.8.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/bin/nginxtra +1 -1
  3. data/bin/nginxtra_rails +1 -1
  4. data/lib/nginxtra/version.rb +1 -1
  5. data/vendor/nginx/CHANGES +358 -14
  6. data/vendor/nginx/CHANGES.ru +372 -18
  7. data/vendor/nginx/LICENSE +2 -2
  8. data/vendor/nginx/auto/cc/clang +5 -0
  9. data/vendor/nginx/auto/cc/gcc +5 -0
  10. data/vendor/nginx/auto/lib/google-perftools/conf +1 -1
  11. data/vendor/nginx/auto/lib/openssl/make +0 -5
  12. data/vendor/nginx/auto/lib/perl/conf +9 -1
  13. data/vendor/nginx/auto/make +1 -1
  14. data/vendor/nginx/auto/modules +11 -0
  15. data/vendor/nginx/auto/options +10 -2
  16. data/vendor/nginx/auto/os/darwin +0 -1
  17. data/vendor/nginx/auto/os/freebsd +6 -23
  18. data/vendor/nginx/auto/sources +16 -14
  19. data/vendor/nginx/auto/summary +3 -24
  20. data/vendor/nginx/auto/threads +20 -0
  21. data/vendor/nginx/auto/types/sizeof +2 -12
  22. data/vendor/nginx/auto/unix +50 -6
  23. data/vendor/nginx/configure +5 -0
  24. data/vendor/nginx/contrib/vim/syntax/nginx.vim +183 -50
  25. data/vendor/nginx/src/core/nginx.c +21 -9
  26. data/vendor/nginx/src/core/nginx.h +8 -2
  27. data/vendor/nginx/src/core/ngx_buf.c +88 -0
  28. data/vendor/nginx/src/core/ngx_buf.h +15 -1
  29. data/vendor/nginx/src/core/ngx_conf_file.c +4 -1
  30. data/vendor/nginx/src/core/ngx_connection.c +25 -66
  31. data/vendor/nginx/src/core/ngx_connection.h +1 -3
  32. data/vendor/nginx/src/core/ngx_core.h +11 -3
  33. data/vendor/nginx/src/core/ngx_crypt.c +1 -1
  34. data/vendor/nginx/src/core/ngx_cycle.c +7 -1
  35. data/vendor/nginx/src/core/ngx_cycle.h +6 -2
  36. data/vendor/nginx/src/core/ngx_file.c +13 -5
  37. data/vendor/nginx/src/core/ngx_file.h +6 -0
  38. data/vendor/nginx/src/core/ngx_log.c +215 -21
  39. data/vendor/nginx/src/core/ngx_log.h +9 -1
  40. data/vendor/nginx/src/core/ngx_output_chain.c +104 -15
  41. data/vendor/nginx/src/core/ngx_palloc.c +3 -7
  42. data/vendor/nginx/src/core/ngx_rbtree.c +2 -4
  43. data/vendor/nginx/src/core/ngx_rbtree.h +2 -4
  44. data/vendor/nginx/src/core/ngx_regex.c +14 -6
  45. data/vendor/nginx/src/core/ngx_resolver.c +16 -23
  46. data/vendor/nginx/src/core/ngx_resolver.h +8 -7
  47. data/vendor/nginx/src/core/ngx_shmtx.c +1 -1
  48. data/vendor/nginx/src/core/ngx_slab.c +89 -2
  49. data/vendor/nginx/src/core/ngx_slab.h +3 -0
  50. data/vendor/nginx/src/core/ngx_string.c +58 -2
  51. data/vendor/nginx/src/core/ngx_string.h +1 -0
  52. data/vendor/nginx/src/core/ngx_syslog.c +374 -0
  53. data/vendor/nginx/src/core/ngx_syslog.h +30 -0
  54. data/vendor/nginx/src/core/ngx_thread_pool.c +630 -0
  55. data/vendor/nginx/src/core/ngx_thread_pool.h +36 -0
  56. data/vendor/nginx/src/core/ngx_times.c +19 -2
  57. data/vendor/nginx/src/core/ngx_times.h +1 -0
  58. data/vendor/nginx/src/event/modules/ngx_aio_module.c +1 -1
  59. data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +9 -24
  60. data/vendor/nginx/src/event/modules/ngx_epoll_module.c +152 -28
  61. data/vendor/nginx/src/event/modules/ngx_eventport_module.c +43 -25
  62. data/vendor/nginx/src/event/modules/ngx_kqueue_module.c +86 -156
  63. data/vendor/nginx/src/event/modules/ngx_poll_module.c +21 -37
  64. data/vendor/nginx/src/event/modules/ngx_rtsig_module.c +15 -27
  65. data/vendor/nginx/src/event/modules/ngx_select_module.c +10 -12
  66. data/vendor/nginx/src/event/modules/ngx_win32_select_module.c +7 -9
  67. data/vendor/nginx/src/event/ngx_event.c +5 -33
  68. data/vendor/nginx/src/event/ngx_event.h +15 -50
  69. data/vendor/nginx/src/event/ngx_event_accept.c +11 -10
  70. data/vendor/nginx/src/event/ngx_event_connect.c +0 -11
  71. data/vendor/nginx/src/event/ngx_event_connect.h +1 -4
  72. data/vendor/nginx/src/event/ngx_event_openssl.c +622 -38
  73. data/vendor/nginx/src/event/ngx_event_openssl.h +20 -2
  74. data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +5 -1
  75. data/vendor/nginx/src/event/ngx_event_pipe.c +45 -19
  76. data/vendor/nginx/src/event/ngx_event_pipe.h +3 -0
  77. data/vendor/nginx/src/event/ngx_event_posted.c +7 -145
  78. data/vendor/nginx/src/event/ngx_event_posted.h +12 -39
  79. data/vendor/nginx/src/event/ngx_event_timer.c +50 -70
  80. data/vendor/nginx/src/event/ngx_event_timer.h +2 -14
  81. data/vendor/nginx/src/http/modules/ngx_http_addition_filter_module.c +1 -1
  82. data/vendor/nginx/src/http/modules/ngx_http_autoindex_module.c +416 -71
  83. data/vendor/nginx/src/http/modules/ngx_http_charset_filter_module.c +19 -15
  84. data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +16 -4
  85. data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +601 -134
  86. data/vendor/nginx/src/http/modules/ngx_http_geo_module.c +1 -1
  87. data/vendor/nginx/src/http/modules/ngx_http_geoip_module.c +9 -3
  88. data/vendor/nginx/src/http/modules/ngx_http_gunzip_filter_module.c +9 -3
  89. data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +9 -3
  90. data/vendor/nginx/src/http/modules/ngx_http_gzip_static_module.c +0 -2
  91. data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +197 -91
  92. data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +1 -0
  93. data/vendor/nginx/src/http/modules/ngx_http_limit_conn_module.c +65 -162
  94. data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +53 -67
  95. data/vendor/nginx/src/http/modules/ngx_http_log_module.c +128 -23
  96. data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +25 -6
  97. data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +1 -1
  98. data/vendor/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +39 -13
  99. data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +697 -141
  100. data/vendor/nginx/src/http/modules/ngx_http_rewrite_module.c +5 -1
  101. data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +282 -125
  102. data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +4 -1
  103. data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +44 -1
  104. data/vendor/nginx/src/http/modules/ngx_http_ssl_module.h +2 -0
  105. data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +10 -8
  106. data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +18 -3
  107. data/vendor/nginx/src/http/modules/ngx_http_upstream_hash_module.c +641 -0
  108. data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +1 -1
  109. data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +3 -21
  110. data/vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +0 -5
  111. data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +449 -125
  112. data/vendor/nginx/src/http/modules/ngx_http_xslt_filter_module.c +4 -2
  113. data/vendor/nginx/src/http/modules/perl/ngx_http_perl_module.c +2 -1
  114. data/vendor/nginx/src/http/ngx_http.c +10 -5
  115. data/vendor/nginx/src/http/ngx_http.h +4 -4
  116. data/vendor/nginx/src/http/ngx_http_cache.h +26 -1
  117. data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +109 -68
  118. data/vendor/nginx/src/http/ngx_http_core_module.c +191 -46
  119. data/vendor/nginx/src/http/ngx_http_core_module.h +16 -4
  120. data/vendor/nginx/src/http/ngx_http_file_cache.c +584 -67
  121. data/vendor/nginx/src/http/ngx_http_parse.c +55 -4
  122. data/vendor/nginx/src/http/ngx_http_request.c +14 -6
  123. data/vendor/nginx/src/http/ngx_http_request.h +12 -4
  124. data/vendor/nginx/src/http/ngx_http_request_body.c +114 -28
  125. data/vendor/nginx/src/http/ngx_http_spdy.c +383 -229
  126. data/vendor/nginx/src/http/ngx_http_spdy.h +8 -5
  127. data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +12 -4
  128. data/vendor/nginx/src/http/ngx_http_special_response.c +2 -2
  129. data/vendor/nginx/src/http/ngx_http_upstream.c +808 -132
  130. data/vendor/nginx/src/http/ngx_http_upstream.h +33 -3
  131. data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +72 -65
  132. data/vendor/nginx/src/http/ngx_http_upstream_round_robin.h +1 -2
  133. data/vendor/nginx/src/http/ngx_http_variables.c +47 -3
  134. data/vendor/nginx/src/http/ngx_http_write_filter_module.c +15 -6
  135. data/vendor/nginx/src/mail/ngx_mail.c +2 -3
  136. data/vendor/nginx/src/mail/ngx_mail.h +2 -0
  137. data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +140 -11
  138. data/vendor/nginx/src/mail/ngx_mail_core_module.c +3 -3
  139. data/vendor/nginx/src/mail/ngx_mail_handler.c +79 -2
  140. data/vendor/nginx/src/mail/ngx_mail_imap_module.c +3 -1
  141. data/vendor/nginx/src/mail/ngx_mail_pop3_module.c +3 -1
  142. data/vendor/nginx/src/mail/ngx_mail_smtp_module.c +3 -1
  143. data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +125 -1
  144. data/vendor/nginx/src/mail/ngx_mail_ssl_module.h +8 -0
  145. data/vendor/nginx/src/misc/ngx_cpp_test_module.cpp +1 -1
  146. data/vendor/nginx/src/os/unix/ngx_aio_read_chain.c +1 -1
  147. data/vendor/nginx/src/os/unix/ngx_channel.c +0 -7
  148. data/vendor/nginx/src/os/unix/ngx_darwin_config.h +0 -3
  149. data/vendor/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +44 -208
  150. data/vendor/nginx/src/os/unix/ngx_file_aio_read.c +25 -17
  151. data/vendor/nginx/src/os/unix/ngx_files.c +109 -0
  152. data/vendor/nginx/src/os/unix/ngx_files.h +6 -0
  153. data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +0 -6
  154. data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +78 -206
  155. data/vendor/nginx/src/os/unix/ngx_linux_aio_read.c +25 -14
  156. data/vendor/nginx/src/os/unix/ngx_linux_config.h +4 -1
  157. data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +235 -194
  158. data/vendor/nginx/src/os/unix/ngx_os.h +25 -3
  159. data/vendor/nginx/src/os/unix/ngx_posix_init.c +4 -2
  160. data/vendor/nginx/src/os/unix/ngx_process_cycle.c +13 -195
  161. data/vendor/nginx/src/os/unix/ngx_process_cycle.h +0 -1
  162. data/vendor/nginx/src/os/unix/ngx_readv_chain.c +27 -108
  163. data/vendor/nginx/src/os/unix/ngx_setproctitle.h +2 -2
  164. data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +12 -67
  165. data/vendor/nginx/src/os/unix/ngx_thread.h +26 -83
  166. data/vendor/nginx/src/os/unix/ngx_thread_cond.c +87 -0
  167. data/vendor/nginx/src/os/unix/ngx_thread_id.c +70 -0
  168. data/vendor/nginx/src/os/unix/ngx_thread_mutex.c +174 -0
  169. data/vendor/nginx/src/os/unix/ngx_user.c +2 -20
  170. data/vendor/nginx/src/os/unix/ngx_writev_chain.c +129 -98
  171. metadata +16 -17
  172. data/vendor/nginx/auto/lib/zlib/patch.zlib.h +0 -10
  173. data/vendor/nginx/src/event/ngx_event_busy_lock.c +0 -286
  174. data/vendor/nginx/src/event/ngx_event_busy_lock.h +0 -65
  175. data/vendor/nginx/src/event/ngx_event_mutex.c +0 -70
  176. data/vendor/nginx/src/http/ngx_http_busy_lock.c +0 -307
  177. data/vendor/nginx/src/http/ngx_http_busy_lock.h +0 -54
  178. data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +0 -756
  179. data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +0 -122
  180. data/vendor/nginx/src/os/unix/ngx_pthread_thread.c +0 -278
  181. data/vendor/nginx/src/os/unix/rfork_thread.S +0 -73
@@ -22,7 +22,7 @@ static char *ngx_poll_init_conf(ngx_cycle_t *cycle, void *conf);
22
22
 
23
23
 
24
24
  static struct pollfd *event_list;
25
- static ngx_int_t nevents;
25
+ static ngx_uint_t nevents;
26
26
 
27
27
 
28
28
  static ngx_str_t poll_name = ngx_string("poll");
@@ -39,7 +39,7 @@ ngx_event_module_t ngx_poll_module_ctx = {
39
39
  ngx_poll_del_event, /* disable an event */
40
40
  NULL, /* add an connection */
41
41
  NULL, /* delete an connection */
42
- NULL, /* process the changes */
42
+ NULL, /* trigger a notify */
43
43
  ngx_poll_process_events, /* process the events */
44
44
  ngx_poll_init, /* init the events */
45
45
  ngx_poll_done /* done the events */
@@ -198,7 +198,7 @@ ngx_poll_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
198
198
  if (e == NULL || e->index == NGX_INVALID_INDEX) {
199
199
  nevents--;
200
200
 
201
- if (ev->index < (ngx_uint_t) nevents) {
201
+ if (ev->index < nevents) {
202
202
 
203
203
  ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
204
204
  "index: copy event %ui to %i", nevents, ev->index);
@@ -212,11 +212,11 @@ ngx_poll_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
212
212
  "unexpected last event");
213
213
 
214
214
  } else {
215
- if (c->read->index == (ngx_uint_t) nevents) {
215
+ if (c->read->index == nevents) {
216
216
  c->read->index = ev->index;
217
217
  }
218
218
 
219
- if (c->write->index == (ngx_uint_t) nevents) {
219
+ if (c->write->index == nevents) {
220
220
  c->write->index = ev->index;
221
221
  }
222
222
  }
@@ -240,9 +240,9 @@ ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
240
240
  {
241
241
  int ready, revents;
242
242
  ngx_err_t err;
243
- ngx_int_t i, nready;
244
- ngx_uint_t found, level;
245
- ngx_event_t *ev, **queue;
243
+ ngx_uint_t i, found, level;
244
+ ngx_event_t *ev;
245
+ ngx_queue_t *queue;
246
246
  ngx_connection_t *c;
247
247
 
248
248
  /* NGX_TIMER_INFINITE == INFTIM */
@@ -251,7 +251,7 @@ ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
251
251
  if (cycle->log->log_level & NGX_LOG_DEBUG_ALL) {
252
252
  for (i = 0; i < nevents; i++) {
253
253
  ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
254
- "poll: %d: fd:%d ev:%04Xd",
254
+ "poll: %ui: fd:%d ev:%04Xd",
255
255
  i, event_list[i].fd, event_list[i].events);
256
256
  }
257
257
  }
@@ -268,7 +268,7 @@ ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
268
268
  }
269
269
 
270
270
  ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
271
- "poll ready %d of %d", ready, nevents);
271
+ "poll ready %d of %ui", ready, nevents);
272
272
 
273
273
  if (err) {
274
274
  if (err == NGX_EINTR) {
@@ -298,22 +298,18 @@ ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
298
298
  return NGX_ERROR;
299
299
  }
300
300
 
301
- ngx_mutex_lock(ngx_posted_events_mutex);
302
-
303
- nready = 0;
304
-
305
301
  for (i = 0; i < nevents && ready; i++) {
306
302
 
307
303
  revents = event_list[i].revents;
308
304
 
309
305
  #if 1
310
306
  ngx_log_debug4(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
311
- "poll: %d: fd:%d ev:%04Xd rev:%04Xd",
307
+ "poll: %ui: fd:%d ev:%04Xd rev:%04Xd",
312
308
  i, event_list[i].fd, event_list[i].events, revents);
313
309
  #else
314
310
  if (revents) {
315
311
  ngx_log_debug4(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
316
- "poll: %d: fd:%d ev:%04Xd rev:%04Xd",
312
+ "poll: %ui: fd:%d ev:%04Xd rev:%04Xd",
317
313
  i, event_list[i].fd, event_list[i].events, revents);
318
314
  }
319
315
  #endif
@@ -375,31 +371,21 @@ ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
375
371
  found = 1;
376
372
 
377
373
  ev = c->read;
374
+ ev->ready = 1;
378
375
 
379
- if ((flags & NGX_POST_THREAD_EVENTS) && !ev->accept) {
380
- ev->posted_ready = 1;
381
-
382
- } else {
383
- ev->ready = 1;
384
- }
376
+ queue = ev->accept ? &ngx_posted_accept_events
377
+ : &ngx_posted_events;
385
378
 
386
- queue = (ngx_event_t **) (ev->accept ? &ngx_posted_accept_events:
387
- &ngx_posted_events);
388
- ngx_locked_post_event(ev, queue);
379
+ ngx_post_event(ev, queue);
389
380
  }
390
381
 
391
382
  if ((revents & POLLOUT) && c->write->active) {
392
383
  found = 1;
393
- ev = c->write;
394
384
 
395
- if (flags & NGX_POST_THREAD_EVENTS) {
396
- ev->posted_ready = 1;
397
-
398
- } else {
399
- ev->ready = 1;
400
- }
385
+ ev = c->write;
386
+ ev->ready = 1;
401
387
 
402
- ngx_locked_post_event(ev, &ngx_posted_events);
388
+ ngx_post_event(ev, &ngx_posted_events);
403
389
  }
404
390
 
405
391
  if (found) {
@@ -408,13 +394,11 @@ ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
408
394
  }
409
395
  }
410
396
 
411
- ngx_mutex_unlock(ngx_posted_events_mutex);
412
-
413
397
  if (ready != 0) {
414
398
  ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "poll ready != events");
415
399
  }
416
400
 
417
- return nready;
401
+ return NGX_OK;
418
402
  }
419
403
 
420
404
 
@@ -429,7 +413,7 @@ ngx_poll_init_conf(ngx_cycle_t *cycle, void *conf)
429
413
  return NGX_CONF_OK;
430
414
  }
431
415
 
432
- #if (NGX_THREADS)
416
+ #if (NGX_OLD_THREADS)
433
417
 
434
418
  ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
435
419
  "poll() is not supported in the threaded mode");
@@ -130,7 +130,7 @@ ngx_event_module_t ngx_rtsig_module_ctx = {
130
130
  NULL, /* disable an event */
131
131
  ngx_rtsig_add_connection, /* add an connection */
132
132
  ngx_rtsig_del_connection, /* delete an connection */
133
- NULL, /* process the changes */
133
+ NULL, /* trigger a notify */
134
134
  ngx_rtsig_process_events, /* process the events */
135
135
  ngx_rtsig_init, /* init the events */
136
136
  ngx_rtsig_done, /* done the events */
@@ -307,7 +307,8 @@ ngx_rtsig_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
307
307
  ngx_int_t instance;
308
308
  ngx_err_t err;
309
309
  siginfo_t si;
310
- ngx_event_t *rev, *wev, **queue;
310
+ ngx_event_t *rev, *wev;
311
+ ngx_queue_t *queue;
311
312
  struct timespec ts, *tp;
312
313
  struct sigaction sa;
313
314
  ngx_connection_t *c;
@@ -404,10 +405,10 @@ ngx_rtsig_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
404
405
  rev->ready = 1;
405
406
 
406
407
  if (flags & NGX_POST_EVENTS) {
407
- queue = (ngx_event_t **) (rev->accept ?
408
- &ngx_posted_accept_events : &ngx_posted_events);
408
+ queue = rev->accept ? &ngx_posted_accept_events
409
+ : &ngx_posted_events;
409
410
 
410
- ngx_locked_post_event(rev, queue);
411
+ ngx_post_event(rev, queue);
411
412
 
412
413
  } else {
413
414
  rev->handler(rev);
@@ -421,7 +422,7 @@ ngx_rtsig_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
421
422
  wev->ready = 1;
422
423
 
423
424
  if (flags & NGX_POST_EVENTS) {
424
- ngx_locked_post_event(wev, &ngx_posted_events);
425
+ ngx_post_event(wev, &ngx_posted_events);
425
426
 
426
427
  } else {
427
428
  wev->handler(wev);
@@ -480,7 +481,8 @@ ngx_rtsig_process_overflow(ngx_cycle_t *cycle, ngx_msec_t timer,
480
481
  size_t len;
481
482
  ngx_err_t err;
482
483
  ngx_uint_t tested, n, i;
483
- ngx_event_t *rev, *wev, **queue;
484
+ ngx_event_t *rev, *wev;
485
+ ngx_queue_t *queue;
484
486
  ngx_connection_t *c;
485
487
  ngx_rtsig_conf_t *rtscf;
486
488
 
@@ -554,8 +556,6 @@ ngx_rtsig_process_overflow(ngx_cycle_t *cycle, ngx_msec_t timer,
554
556
  continue;
555
557
  }
556
558
 
557
- ngx_mutex_lock(ngx_posted_events_mutex);
558
-
559
559
  for (i = 0; i < n; i++) {
560
560
  c = cycle->files[overflow_list[i].fd];
561
561
 
@@ -573,18 +573,13 @@ ngx_rtsig_process_overflow(ngx_cycle_t *cycle, ngx_msec_t timer,
573
573
  {
574
574
  tested++;
575
575
 
576
- if ((flags & NGX_POST_THREAD_EVENTS) && !rev->accept) {
577
- rev->posted_ready = 1;
578
-
579
- } else {
580
- rev->ready = 1;
581
- }
576
+ rev->ready = 1;
582
577
 
583
578
  if (flags & NGX_POST_EVENTS) {
584
- queue = (ngx_event_t **) (rev->accept ?
585
- &ngx_posted_accept_events : &ngx_posted_events);
579
+ queue = rev->accept ? &ngx_posted_accept_events
580
+ : &ngx_posted_events;
586
581
 
587
- ngx_locked_post_event(rev, queue);
582
+ ngx_post_event(rev, queue);
588
583
 
589
584
  } else {
590
585
  rev->handler(rev);
@@ -601,15 +596,10 @@ ngx_rtsig_process_overflow(ngx_cycle_t *cycle, ngx_msec_t timer,
601
596
  {
602
597
  tested++;
603
598
 
604
- if (flags & NGX_POST_THREAD_EVENTS) {
605
- wev->posted_ready = 1;
606
-
607
- } else {
608
- wev->ready = 1;
609
- }
599
+ wev->ready = 1;
610
600
 
611
601
  if (flags & NGX_POST_EVENTS) {
612
- ngx_locked_post_event(wev, &ngx_posted_events);
602
+ ngx_post_event(wev, &ngx_posted_events);
613
603
 
614
604
  } else {
615
605
  wev->handler(wev);
@@ -617,8 +607,6 @@ ngx_rtsig_process_overflow(ngx_cycle_t *cycle, ngx_msec_t timer,
617
607
  }
618
608
  }
619
609
 
620
- ngx_mutex_unlock(ngx_posted_events_mutex);
621
-
622
610
  if (tested >= rtscf->overflow_test) {
623
611
 
624
612
  if (ngx_linux_rtsig_max) {
@@ -47,7 +47,7 @@ ngx_event_module_t ngx_select_module_ctx = {
47
47
  ngx_select_del_event, /* disable an event */
48
48
  NULL, /* add an connection */
49
49
  NULL, /* delete an connection */
50
- NULL, /* process the changes */
50
+ NULL, /* trigger a notify */
51
51
  ngx_select_process_events, /* process the events */
52
52
  ngx_select_init, /* init the events */
53
53
  ngx_select_done /* done the events */
@@ -214,7 +214,8 @@ ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
214
214
  int ready, nready;
215
215
  ngx_err_t err;
216
216
  ngx_uint_t i, found;
217
- ngx_event_t *ev, **queue;
217
+ ngx_event_t *ev;
218
+ ngx_queue_t *queue;
218
219
  struct timeval tv, *tp;
219
220
  ngx_connection_t *c;
220
221
 
@@ -227,7 +228,7 @@ ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
227
228
  }
228
229
 
229
230
  ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
230
- "change max_fd: %d", max_fd);
231
+ "change max_fd: %i", max_fd);
231
232
  }
232
233
 
233
234
  #if (NGX_DEBUG)
@@ -240,7 +241,7 @@ ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
240
241
  }
241
242
 
242
243
  ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
243
- "max_fd: %d", max_fd);
244
+ "max_fd: %i", max_fd);
244
245
  }
245
246
  #endif
246
247
 
@@ -305,8 +306,6 @@ ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
305
306
  return NGX_ERROR;
306
307
  }
307
308
 
308
- ngx_mutex_lock(ngx_posted_events_mutex);
309
-
310
309
  nready = 0;
311
310
 
312
311
  for (i = 0; i < nevents; i++) {
@@ -332,16 +331,15 @@ ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
332
331
  if (found) {
333
332
  ev->ready = 1;
334
333
 
335
- queue = (ngx_event_t **) (ev->accept ? &ngx_posted_accept_events:
336
- &ngx_posted_events);
337
- ngx_locked_post_event(ev, queue);
334
+ queue = ev->accept ? &ngx_posted_accept_events
335
+ : &ngx_posted_events;
336
+
337
+ ngx_post_event(ev, queue);
338
338
 
339
339
  nready++;
340
340
  }
341
341
  }
342
342
 
343
- ngx_mutex_unlock(ngx_posted_events_mutex);
344
-
345
343
  if (ready != nready) {
346
344
  ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
347
345
  "select ready != events: %d:%d", ready, nready);
@@ -421,7 +419,7 @@ ngx_select_init_conf(ngx_cycle_t *cycle, void *conf)
421
419
  return NGX_CONF_ERROR;
422
420
  }
423
421
 
424
- #if (NGX_THREADS)
422
+ #if (NGX_OLD_THREADS)
425
423
 
426
424
  ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
427
425
  "select() is not supported in the threaded mode");
@@ -48,7 +48,7 @@ ngx_event_module_t ngx_select_module_ctx = {
48
48
  ngx_select_del_event, /* disable an event */
49
49
  NULL, /* add an connection */
50
50
  NULL, /* delete an connection */
51
- NULL, /* process the changes */
51
+ NULL, /* trigger a notify */
52
52
  ngx_select_process_events, /* process the events */
53
53
  ngx_select_init, /* init the events */
54
54
  ngx_select_done /* done the events */
@@ -221,7 +221,8 @@ ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
221
221
  int ready, nready;
222
222
  ngx_err_t err;
223
223
  ngx_uint_t i, found;
224
- ngx_event_t *ev, **queue;
224
+ ngx_event_t *ev;
225
+ ngx_queue_t *queue;
225
226
  struct timeval tv, *tp;
226
227
  ngx_connection_t *c;
227
228
 
@@ -296,8 +297,6 @@ ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
296
297
  return NGX_ERROR;
297
298
  }
298
299
 
299
- ngx_mutex_lock(ngx_posted_events_mutex);
300
-
301
300
  nready = 0;
302
301
 
303
302
  for (i = 0; i < nevents; i++) {
@@ -323,16 +322,15 @@ ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
323
322
  if (found) {
324
323
  ev->ready = 1;
325
324
 
326
- queue = (ngx_event_t **) (ev->accept ? &ngx_posted_accept_events:
327
- &ngx_posted_events);
328
- ngx_locked_post_event(ev, queue);
325
+ queue = ev->accept ? &ngx_posted_accept_events
326
+ : &ngx_posted_events;
327
+
328
+ ngx_post_event(ev, queue);
329
329
 
330
330
  nready++;
331
331
  }
332
332
  }
333
333
 
334
- ngx_mutex_unlock(ngx_posted_events_mutex);
335
-
336
334
  if (ready != nready) {
337
335
  ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
338
336
  "select ready != events: %d:%d", ready, nready);
@@ -212,7 +212,7 @@ ngx_process_events_and_timers(ngx_cycle_t *cycle)
212
212
  timer = ngx_event_find_timer();
213
213
  flags = NGX_UPDATE_TIME;
214
214
 
215
- #if (NGX_THREADS)
215
+ #if (NGX_OLD_THREADS)
216
216
 
217
217
  if (timer == NGX_TIMER_INFINITE || timer > 500) {
218
218
  timer = 500;
@@ -252,9 +252,7 @@ ngx_process_events_and_timers(ngx_cycle_t *cycle)
252
252
  ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
253
253
  "timer delta: %M", delta);
254
254
 
255
- if (ngx_posted_accept_events) {
256
- ngx_event_process_posted(cycle, &ngx_posted_accept_events);
257
- }
255
+ ngx_event_process_posted(cycle, &ngx_posted_accept_events);
258
256
 
259
257
  if (ngx_accept_mutex_held) {
260
258
  ngx_shmtx_unlock(&ngx_accept_mutex);
@@ -264,17 +262,7 @@ ngx_process_events_and_timers(ngx_cycle_t *cycle)
264
262
  ngx_event_expire_timers();
265
263
  }
266
264
 
267
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
268
- "posted events %p", ngx_posted_events);
269
-
270
- if (ngx_posted_events) {
271
- if (ngx_threaded) {
272
- ngx_wakeup_worker_thread(cycle);
273
-
274
- } else {
275
- ngx_event_process_posted(cycle, &ngx_posted_events);
276
- }
277
- }
265
+ ngx_event_process_posted(cycle, &ngx_posted_events);
278
266
  }
279
267
 
280
268
 
@@ -617,12 +605,8 @@ ngx_event_process_init(ngx_cycle_t *cycle)
617
605
 
618
606
  #endif
619
607
 
620
- #if (NGX_THREADS)
621
- ngx_posted_events_mutex = ngx_mutex_init(cycle->log, 0);
622
- if (ngx_posted_events_mutex == NULL) {
623
- return NGX_ERROR;
624
- }
625
- #endif
608
+ ngx_queue_init(&ngx_posted_accept_events);
609
+ ngx_queue_init(&ngx_posted_events);
626
610
 
627
611
  if (ngx_event_timer_init(cycle->log) == NGX_ERROR) {
628
612
  return NGX_ERROR;
@@ -712,10 +696,6 @@ ngx_event_process_init(ngx_cycle_t *cycle)
712
696
  for (i = 0; i < cycle->connection_n; i++) {
713
697
  rev[i].closed = 1;
714
698
  rev[i].instance = 1;
715
- #if (NGX_THREADS)
716
- rev[i].lock = &c[i].lock;
717
- rev[i].own_lock = &c[i].lock;
718
- #endif
719
699
  }
720
700
 
721
701
  cycle->write_events = ngx_alloc(sizeof(ngx_event_t) * cycle->connection_n,
@@ -727,10 +707,6 @@ ngx_event_process_init(ngx_cycle_t *cycle)
727
707
  wev = cycle->write_events;
728
708
  for (i = 0; i < cycle->connection_n; i++) {
729
709
  wev[i].closed = 1;
730
- #if (NGX_THREADS)
731
- wev[i].lock = &c[i].lock;
732
- wev[i].own_lock = &c[i].lock;
733
- #endif
734
710
  }
735
711
 
736
712
  i = cycle->connection_n;
@@ -745,10 +721,6 @@ ngx_event_process_init(ngx_cycle_t *cycle)
745
721
  c[i].fd = (ngx_socket_t) -1;
746
722
 
747
723
  next = &c[i];
748
-
749
- #if (NGX_THREADS)
750
- c[i].lock = 0;
751
- #endif
752
724
  } while (i);
753
725
 
754
726
  cycle->free_connections = next;