Mercurial > hg > nginx
comparison src/event/modules/ngx_kqueue_module.c @ 1451:ae957ab627e2
NGX_USE_VNODE_EVENT and NGX_FLUSH_EVENT
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 01 Sep 2007 11:59:36 +0000 |
parents | 576921748c9a |
children | 7018254cc006 |
comparison
equal
deleted
inserted
replaced
1450:a392517403f5 | 1451:ae957ab627e2 |
---|---|
198 if (event_list == NULL) { | 198 if (event_list == NULL) { |
199 return NGX_ERROR; | 199 return NGX_ERROR; |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 ngx_event_flags = 0; | 203 ngx_event_flags = NGX_USE_ONESHOT_EVENT |
204 |NGX_USE_KQUEUE_EVENT | |
205 |NGX_USE_VNODE_EVENT; | |
204 | 206 |
205 #if (NGX_HAVE_TIMER_EVENT) | 207 #if (NGX_HAVE_TIMER_EVENT) |
206 | 208 |
207 if (timer) { | 209 if (timer) { |
208 kev.ident = 0; | 210 kev.ident = 0; |
224 ngx_event_flags |= NGX_USE_TIMER_EVENT; | 226 ngx_event_flags |= NGX_USE_TIMER_EVENT; |
225 } | 227 } |
226 | 228 |
227 #endif | 229 #endif |
228 | 230 |
229 ngx_event_flags |= NGX_USE_ONESHOT_EVENT|NGX_USE_KQUEUE_EVENT; | |
230 | |
231 #if (NGX_HAVE_CLEAR_EVENT) | 231 #if (NGX_HAVE_CLEAR_EVENT) |
232 ngx_event_flags |= NGX_USE_CLEAR_EVENT; | 232 ngx_event_flags |= NGX_USE_CLEAR_EVENT; |
233 #else | 233 #else |
234 ngx_event_flags |= NGX_USE_LEVEL_EVENT; | 234 ngx_event_flags |= NGX_USE_LEVEL_EVENT; |
235 #endif | 235 #endif |
387 return NGX_OK; | 387 return NGX_OK; |
388 } | 388 } |
389 | 389 |
390 if (flags & NGX_DISABLE_EVENT) { | 390 if (flags & NGX_DISABLE_EVENT) { |
391 ev->disabled = 1; | 391 ev->disabled = 1; |
392 } | 392 |
393 | 393 } else { |
394 rc = ngx_kqueue_set_event(ev, event, | 394 flags |= EV_DELETE; |
395 flags & NGX_DISABLE_EVENT ? EV_DISABLE : EV_DELETE); | 395 } |
396 | |
397 rc = ngx_kqueue_set_event(ev, event, flags); | |
396 | 398 |
397 ngx_mutex_unlock(list_mutex); | 399 ngx_mutex_unlock(list_mutex); |
398 | 400 |
399 return rc; | 401 return rc; |
400 } | 402 } |
463 #endif | 465 #endif |
464 } | 466 } |
465 | 467 |
466 ev->index = nchanges; | 468 ev->index = nchanges; |
467 nchanges++; | 469 nchanges++; |
470 | |
471 if (flags & NGX_FLUSH_EVENT) { | |
472 ts.tv_sec = 0; | |
473 ts.tv_nsec = 0; | |
474 | |
475 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ev->log, 0, "kevent flush"); | |
476 | |
477 if (kevent(ngx_kqueue, change_list, (int) nchanges, NULL, 0, &ts) | |
478 == -1) | |
479 { | |
480 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno, "kevent() failed"); | |
481 return NGX_ERROR; | |
482 } | |
483 | |
484 nchanges = 0; | |
485 } | |
468 | 486 |
469 return NGX_OK; | 487 return NGX_OK; |
470 } | 488 } |
471 | 489 |
472 | 490 |