comparison src/event/ngx_event.h @ 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 00c5660d2707
children ce375c313e96
comparison
equal deleted inserted replaced
305:4b1a3a4acc60 306:6b91bfbc4123
63 unsigned char oneshot:1; 63 unsigned char oneshot:1;
64 64
65 unsigned char write:1; 65 unsigned char write:1;
66 66
67 /* used to detect the stale events in kqueue, rt signals and epoll */ 67 /* used to detect the stale events in kqueue, rt signals and epoll */
68 unsigned char use_instance:1;
68 unsigned char instance:1; 69 unsigned char instance:1;
69 unsigned char returned_instance:1; 70 unsigned char returned_instance:1;
70 71
71 /* 72 /*
72 * the event was passed or would be passed to a kernel; 73 * the event was passed or would be passed to a kernel;
77 unsigned char disabled:1; 78 unsigned char disabled:1;
78 79
79 unsigned char posted:1; 80 unsigned char posted:1;
80 81
81 /* the ready event; in aio mode 0 means that no operation can be posted */ 82 /* the ready event; in aio mode 0 means that no operation can be posted */
82 unsigned char ready:1; 83 unsigned short ready:1;
83 84
84 /* aio operation is complete */ 85 /* aio operation is complete */
85 unsigned short complete:1; 86 unsigned short complete:1;
86 87
87 unsigned short eof:1; 88 unsigned short eof:1;
194 195
195 /* 196 /*
196 * The event filter requires to read/write the whole data - 197 * The event filter requires to read/write the whole data -
197 * select, poll, /dev/poll, kqueue, epoll. 198 * select, poll, /dev/poll, kqueue, epoll.
198 */ 199 */
199 #define NGX_USE_LEVEL_EVENT 0x00000001 200 #define NGX_USE_LEVEL_EVENT 0x00000001
200 201
201 /* 202 /*
202 * The event filter is deleted after a notification without an additional 203 * The event filter is deleted after a notification without an additional
203 * syscall - select, poll, kqueue, epoll. 204 * syscall - select, poll, kqueue, epoll.
204 */ 205 */
205 #define NGX_USE_ONESHOT_EVENT 0x00000002 206 #define NGX_USE_ONESHOT_EVENT 0x00000002
206 207
207 /* 208 /*
208 * The event filter notifies only the changes and an initial level - 209 * The event filter notifies only the changes and an initial level -
209 * kqueue, epoll. 210 * kqueue, epoll.
210 */ 211 */
211 #define NGX_USE_CLEAR_EVENT 0x00000004 212 #define NGX_USE_CLEAR_EVENT 0x00000004
212 213
213 /* 214 /*
214 * The event filter has kqueue features - the eof flag, errno, 215 * The event filter has kqueue features - the eof flag, errno,
215 * available data, etc. 216 * available data, etc.
216 */ 217 */
217 #define NGX_HAVE_KQUEUE_EVENT 0x00000008 218 #define NGX_HAVE_KQUEUE_EVENT 0x00000008
218 219
219 /* 220 /*
220 * The event filter supports low water mark - kqueue's NOTE_LOWAT. 221 * The event filter supports low water mark - kqueue's NOTE_LOWAT.
221 * kqueue in FreeBSD 4.1-4.2 has no NOTE_LOWAT so we need a separate flag. 222 * kqueue in FreeBSD 4.1-4.2 has no NOTE_LOWAT so we need a separate flag.
222 */ 223 */
223 #define NGX_HAVE_LOWAT_EVENT 0x00000010 224 #define NGX_HAVE_LOWAT_EVENT 0x00000010
225
226 /*
227 * The event filter allows to pass instance information to check stale events -
228 * kqueue, epoll, rt signals.
229 */
230 #define NGX_HAVE_INSTANCE_EVENT 0x00000020
224 231
225 /* 232 /*
226 * The event filter notifies only the changes (the edges) 233 * The event filter notifies only the changes (the edges)
227 * but not an initial level - early epoll patches. 234 * but not an initial level - early epoll patches.
228 */ 235 */
229 #define NGX_USE_EDGE_EVENT 0x00000020 236 #define NGX_USE_EDGE_EVENT 0x00000040
230 237
231 /* 238 /*
232 * No need to add or delete the event filters - rt signals. 239 * No need to add or delete the event filters - rt signals.
233 */ 240 */
234 #define NGX_USE_SIGIO_EVENT 0x00000040 241 #define NGX_USE_SIGIO_EVENT 0x00000080
235 242
236 /* 243 /*
237 * The alternative event method after the rt signals queue overflow. 244 * The alternative event method after the rt signals queue overflow.
238 */ 245 */
239 #define NGX_OVERFLOW_EVENT 0x00000080 246 #define NGX_OVERFLOW_EVENT 0x00000100
240 247
241 /* 248 /*
242 * No need to add or delete the event filters - overlapped, aio_read, 249 * No need to add or delete the event filters - overlapped, aio_read,
243 * aioread, io_submit. 250 * aioread, io_submit.
244 */ 251 */
245 #define NGX_USE_AIO_EVENT 0x00000100 252 #define NGX_USE_AIO_EVENT 0x00000200
246 253
247 /* 254 /*
248 * Need to add socket or handle only once - i/o completion port. 255 * Need to add socket or handle only once - i/o completion port.
249 * It also requires HAVE_AIO and NGX_USE_AIO_EVENT to be set. 256 * It also requires HAVE_AIO and NGX_USE_AIO_EVENT to be set.
250 */ 257 */
251 #define NGX_USE_IOCP_EVENT 0x00000200 258 #define NGX_USE_IOCP_EVENT 0x00000400
252 259
253 260
254 261
255 /* 262 /*
256 * The event filter is deleted before the closing file. 263 * The event filter is deleted before the closing file.
378 ngx_int_t use; 385 ngx_int_t use;
379 386
380 ngx_flag_t multi_accept; 387 ngx_flag_t multi_accept;
381 ngx_flag_t accept_mutex; 388 ngx_flag_t accept_mutex;
382 389
390 ngx_msec_t accept_mutex_delay;
391
383 u_char *name; 392 u_char *name;
384 } ngx_event_conf_t; 393 } ngx_event_conf_t;
385 394
386 395
387 typedef struct { 396 typedef struct {
392 401
393 ngx_event_actions_t actions; 402 ngx_event_actions_t actions;
394 } ngx_event_module_t; 403 } ngx_event_module_t;
395 404
396 405
397
398 extern ngx_thread_volatile ngx_event_t *ngx_posted_events;
399 #if (NGX_THREADS)
400 extern ngx_mutex_t *ngx_posted_events_mutex;
401 #endif
402 406
403 extern ngx_atomic_t *ngx_accept_mutex_ptr; 407 extern ngx_atomic_t *ngx_accept_mutex_ptr;
404 extern ngx_atomic_t *ngx_accept_mutex; 408 extern ngx_atomic_t *ngx_accept_mutex;
405 extern ngx_uint_t ngx_accept_mutex_held; 409 extern ngx_uint_t ngx_accept_mutex_held;
410 extern ngx_msec_t ngx_accept_mutex_delay;
411
406 412
407 #define ngx_accept_mutex_unlock() \ 413 #define ngx_accept_mutex_unlock() \
408 if (ngx_accept_mutex_held) { \ 414 if (ngx_accept_mutex_held) { \
409 *ngx_accept_mutex = 0; \ 415 *ngx_accept_mutex = 0; \
410 } 416 }
435 /* used in ngx_log_debugX() */ 441 /* used in ngx_log_debugX() */
436 #define ngx_event_ident(p) ((ngx_connection_t *) (p))->fd 442 #define ngx_event_ident(p) ((ngx_connection_t *) (p))->fd
437 443
438 444
439 #include <ngx_event_timer.h> 445 #include <ngx_event_timer.h>
446 #include <ngx_event_posted.h>
440 #include <ngx_event_busy_lock.h> 447 #include <ngx_event_busy_lock.h>
441 448
442 #if (WIN32) 449 #if (WIN32)
443 #include <ngx_iocp_module.h> 450 #include <ngx_iocp_module.h>
444 #endif 451 #endif