Mercurial > hg > nginx
comparison src/event/modules/ngx_kqueue_module.c @ 272:d4e65d74db9f
nginx-0.0.2-2004-03-01-00:03:02 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 29 Feb 2004 21:03:02 +0000 |
parents | e16dfb9b9afa |
children | 744965ec6275 |
comparison
equal
deleted
inserted
replaced
271:e16dfb9b9afa | 272:d4e65d74db9f |
---|---|
20 static void ngx_kqueue_done(ngx_cycle_t *cycle); | 20 static void ngx_kqueue_done(ngx_cycle_t *cycle); |
21 static int ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags); | 21 static int ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags); |
22 static int ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags); | 22 static int ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags); |
23 static int ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags); | 23 static int ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags); |
24 static int ngx_kqueue_process_events(ngx_log_t *log); | 24 static int ngx_kqueue_process_events(ngx_log_t *log); |
25 #if (NGX_THREADS) | |
26 static void ngx_kqueue_thread_handler(ngx_event_t *ev); | |
27 #endif | |
25 | 28 |
26 static void *ngx_kqueue_create_conf(ngx_cycle_t *cycle); | 29 static void *ngx_kqueue_create_conf(ngx_cycle_t *cycle); |
27 static char *ngx_kqueue_init_conf(ngx_cycle_t *cycle, void *conf); | 30 static char *ngx_kqueue_init_conf(ngx_cycle_t *cycle, void *conf); |
28 | 31 |
29 | 32 |
66 ngx_kqueue_add_event, /* enable an event */ | 69 ngx_kqueue_add_event, /* enable an event */ |
67 ngx_kqueue_del_event, /* disable an event */ | 70 ngx_kqueue_del_event, /* disable an event */ |
68 NULL, /* add an connection */ | 71 NULL, /* add an connection */ |
69 NULL, /* delete an connection */ | 72 NULL, /* delete an connection */ |
70 ngx_kqueue_process_events, /* process the events */ | 73 ngx_kqueue_process_events, /* process the events */ |
74 #if (NGX_THREADS0) | |
75 ngx_kqueue_thread_handler, /* process an event by thread */ | |
76 #endif | |
71 ngx_kqueue_init, /* init the events */ | 77 ngx_kqueue_init, /* init the events */ |
72 ngx_kqueue_done /* done the events */ | 78 ngx_kqueue_done /* done the events */ |
73 } | 79 } |
74 | 80 |
75 }; | 81 }; |
498 | 504 |
499 if (ngx_threaded) { | 505 if (ngx_threaded) { |
500 | 506 |
501 if (ev->light) { | 507 if (ev->light) { |
502 | 508 |
503 /* the accept event */ | 509 /* |
510 * The light events are the accept event, | |
511 * or the event that waits in the mutex queue - we need to | |
512 * remove it from the mutex queue before the inserting into | |
513 * the posted events queue. | |
514 */ | |
504 | 515 |
505 ngx_mutex_unlock(ngx_posted_events_mutex); | 516 ngx_mutex_unlock(ngx_posted_events_mutex); |
506 | 517 |
507 ev->event_handler(ev); | 518 ev->event_handler(ev); |
508 | 519 |
536 } | 547 } |
537 #endif | 548 #endif |
538 | 549 |
539 /* TODO: non-thread mode only */ | 550 /* TODO: non-thread mode only */ |
540 | 551 |
541 ev = ngx_posted_events; | 552 for ( ;; ) { |
542 ngx_posted_events = NULL; | 553 |
543 | 554 ev = (ngx_event_t *) ngx_posted_events; |
544 while (ev) { | 555 |
556 if (ev == NULL) { | |
557 break; | |
558 } | |
559 | |
560 ngx_posted_events = ev->next; | |
561 | |
545 ev->event_handler(ev); | 562 ev->event_handler(ev); |
546 ev = ev->next; | |
547 } | 563 } |
548 | 564 |
549 return NGX_OK; | 565 return NGX_OK; |
550 } | 566 } |
551 | 567 |