Mercurial > hg > nginx-quic
comparison src/event/ngx_event_posted.c @ 5821:3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
In theory, this can provide a bit better distribution of latencies.
Also it simplifies the code, since ngx_queue_t is now used instead
of custom implementation.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Mon, 01 Sep 2014 18:20:18 +0400 |
parents | 3377f9459e99 |
children | 9d2ad2fb4423 |
comparison
equal
deleted
inserted
replaced
5820:3377f9459e99 | 5821:3f5f0ab59b35 |
---|---|
8 #include <ngx_config.h> | 8 #include <ngx_config.h> |
9 #include <ngx_core.h> | 9 #include <ngx_core.h> |
10 #include <ngx_event.h> | 10 #include <ngx_event.h> |
11 | 11 |
12 | 12 |
13 ngx_event_t *ngx_posted_accept_events; | 13 ngx_queue_t ngx_posted_accept_events; |
14 ngx_event_t *ngx_posted_events; | 14 ngx_queue_t ngx_posted_events; |
15 | 15 |
16 | 16 |
17 void | 17 void |
18 ngx_event_process_posted(ngx_cycle_t *cycle, ngx_event_t **posted) | 18 ngx_event_process_posted(ngx_cycle_t *cycle, ngx_queue_t *posted) |
19 { | 19 { |
20 ngx_queue_t *q; | |
20 ngx_event_t *ev; | 21 ngx_event_t *ev; |
21 | 22 |
22 for ( ;; ) { | 23 while (!ngx_queue_empty(posted)) { |
23 | 24 |
24 ev = *posted; | 25 q = ngx_queue_head(posted); |
26 ev = ngx_queue_data(q, ngx_event_t, queue); | |
25 | 27 |
26 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, | 28 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
27 "posted event %p", ev); | 29 "posted event %p", ev); |
28 | |
29 if (ev == NULL) { | |
30 return; | |
31 } | |
32 | 30 |
33 ngx_delete_posted_event(ev); | 31 ngx_delete_posted_event(ev); |
34 | 32 |
35 ev->handler(ev); | 33 ev->handler(ev); |
36 } | 34 } |