comparison src/event/ngx_event.h @ 375:744ccb59062d

nginx-0.0.7-2004-07-02-19:54:34 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 02 Jul 2004 15:54:34 +0000
parents 213f17e9f776
children 41437e4fd9b4
comparison
equal deleted inserted replaced
374:213f17e9f776 375:744ccb59062d
32 32
33 33
34 struct ngx_event_s { 34 struct ngx_event_s {
35 void *data; 35 void *data;
36 36
37 /* TODO rename to handler */ 37 unsigned write:1;
38 ngx_event_handler_pt event_handler; 38
39 39 unsigned accept:1;
40 u_int index; 40
41 41 unsigned oneshot:1;
42 /* the link of the posted queue or the event mutecies queues */
43 ngx_event_t *next;
44
45 ngx_log_t *log;
46
47 /*
48 * The inline of "ngx_rbtree_t rbtree;".
49 *
50 * It allows to pack the rbtree_color and the various event bit flags into
51 * the single "int". We also use "unsigned char" and then "unsigned short"
52 * because otherwise MSVC 6.0 uses an additional "int" for the bit flags.
53 * We use "char rbtree_color" instead of "unsigned int rbtree_color:1"
54 * because it preserves the bits order on the big endian platforms.
55 */
56
57 ngx_int_t rbtree_key;
58 void *rbtree_left;
59 void *rbtree_right;
60 void *rbtree_parent;
61 char rbtree_color;
62
63 unsigned char oneshot:1;
64
65 unsigned char write:1;
66 42
67 /* used to detect the stale events in kqueue, rt signals and epoll */ 43 /* used to detect the stale events in kqueue, rt signals and epoll */
68 unsigned char use_instance:1; 44 unsigned use_instance:1;
69 unsigned char instance:1; 45 unsigned instance:1;
70 unsigned char returned_instance:1; 46 unsigned returned_instance:1;
71 47
72 /* 48 /*
73 * the event was passed or would be passed to a kernel; 49 * the event was passed or would be passed to a kernel;
74 * in aio mode - operation was posted. 50 * in aio mode - operation was posted.
75 */ 51 */
76 unsigned char active:1; 52 unsigned active:1;
77 53
78 unsigned char disabled:1; 54 unsigned disabled:1;
79
80 unsigned char posted:1;
81 55
82 /* the ready event; in aio mode 0 means that no operation can be posted */ 56 /* the ready event; in aio mode 0 means that no operation can be posted */
83 unsigned short ready:1; 57 unsigned ready:1;
84 58
85 /* aio operation is complete */ 59 /* aio operation is complete */
86 unsigned short complete:1; 60 unsigned complete:1;
87 61
88 unsigned short eof:1; 62 unsigned eof:1;
89 unsigned short error:1; 63 unsigned error:1;
90 64
91 unsigned short timedout:1; 65 unsigned timedout:1;
92 unsigned short timer_set:1; 66 unsigned timer_set:1;
93 67
94 unsigned short delayed:1; 68 unsigned delayed:1;
95 69
96 unsigned short read_discarded:1; 70 unsigned read_discarded:1;
97 71
98 unsigned short unexpected_eof:1; 72 unsigned unexpected_eof:1;
99 73
100 unsigned short accept:1; 74 unsigned deferred_accept:1;
101 75
102 unsigned short deferred_accept:1; 76 unsigned overflow:1;
103 77
104 unsigned short overflow:1; 78 /* the pending eof reported by kqueue or in aio chain operation */
105 79 unsigned pending_eof:1;
106 /* TODO: aio_eof and kq_eof can be the single pending_eof */
107 /* the pending eof in aio chain operation */
108 unsigned short aio_eof:1;
109
110 /* the pending eof reported by kqueue */
111 unsigned short kq_eof:1;
112 80
113 #if (WIN32) 81 #if (WIN32)
114 /* setsockopt(SO_UPDATE_ACCEPT_CONTEXT) was succesfull */ 82 /* setsockopt(SO_UPDATE_ACCEPT_CONTEXT) was succesfull */
115 unsigned short accept_context_updated:1; 83 unsigned accept_context_updated:1;
116 #endif 84 #endif
117 85
118 #if (HAVE_KQUEUE) 86 #if (HAVE_KQUEUE)
119 unsigned short kq_vnode:1; 87 unsigned kq_vnode:1;
120 88
121 /* the pending errno reported by kqueue */ 89 /* the pending errno reported by kqueue */
122 int kq_errno; 90 int kq_errno;
123 #endif 91 #endif
124 92
137 */ 105 */
138 106
139 #if (HAVE_KQUEUE) || (HAVE_IOCP) 107 #if (HAVE_KQUEUE) || (HAVE_IOCP)
140 int available; 108 int available;
141 #else 109 #else
142 unsigned short available:1; 110 unsigned available:1;
143 #endif 111 #endif
112
113 /* TODO rename to handler */
114 ngx_event_handler_pt event_handler;
144 115
145 116
146 #if (HAVE_AIO) 117 #if (HAVE_AIO)
147 118
148 #if (HAVE_IOCP) 119 #if (HAVE_IOCP)
151 struct aiocb aiocb; 122 struct aiocb aiocb;
152 #endif 123 #endif
153 124
154 #endif 125 #endif
155 126
127 u_int index;
128
129 ngx_log_t *log;
130
131 /* TODO: threads: padding to cache line */
132
133 /*
134 * STUB: The inline of "ngx_rbtree_t rbtree;"
135 */
136
137 ngx_int_t rbtree_key;
138 void *rbtree_left;
139 void *rbtree_right;
140 void *rbtree_parent;
141 char rbtree_color;
142
143
144 unsigned closed:1;
156 145
157 #if (NGX_THREADS) 146 #if (NGX_THREADS)
158
159 ngx_atomic_t *lock;
160 147
161 unsigned locked:1; 148 unsigned locked:1;
162 149
163 unsigned posted_ready:1; 150 unsigned posted_ready:1;
164 unsigned posted_timedout:1; 151 unsigned posted_timedout:1;
173 int posted_available; 160 int posted_available;
174 #else 161 #else
175 unsigned posted_available:1; 162 unsigned posted_available:1;
176 #endif 163 #endif
177 164
178 #endif 165 ngx_atomic_t *lock;
166
167 #endif
168
169 /* the links of the posted queue */
170 ngx_event_t *next;
171 ngx_event_t **prev;
179 172
180 173
181 #if 0 174 #if 0
182 175
183 /* the threads support */ 176 /* the threads support */