comparison src/event/ngx_event.c @ 17:8dd06e2844f5

nginx-0.0.1-2002-09-27-19:05:29 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 27 Sep 2002 15:05:29 +0000
parents f323b4f74e4a
children 72ad26c77d2d
comparison
equal deleted inserted replaced
16:6ce4755737b4 17:8dd06e2844f5
1 1
2 #include <ngx_config.h> 2 #include <ngx_config.h>
3 #include <ngx_core.h>
3 #include <ngx_types.h> 4 #include <ngx_types.h>
4 #include <ngx_string.h> 5 #include <ngx_string.h>
5 #include <ngx_log.h> 6 #include <ngx_log.h>
6 #include <ngx_alloc.h> 7 #include <ngx_alloc.h>
7 #include <ngx_listen.h> 8 #include <ngx_listen.h>
18 ngx_connection_t *ngx_connections; 19 ngx_connection_t *ngx_connections;
19 ngx_event_t *ngx_read_events, *ngx_write_events; 20 ngx_event_t *ngx_read_events, *ngx_write_events;
20 21
21 #if !(USE_KQUEUE) 22 #if !(USE_KQUEUE)
22 23
23 #if 0 24 #if 1
24 ngx_event_type_e ngx_event_type = NGX_SELECT_EVENT; 25 ngx_event_type_e ngx_event_type = NGX_SELECT_EVENT;
25 #else 26 #else
26 ngx_event_type_e ngx_event_type = NGX_KQUEUE_EVENT; 27 ngx_event_type_e ngx_event_type = NGX_KQUEUE_EVENT;
27 #endif 28 #endif
28 29
29 ngx_event_actions_t ngx_event_actions; 30 ngx_event_actions_t ngx_event_actions;
30 31
31 /* ngx_event_type_e order */ 32 /* ngx_event_type_e order */
32 static void (*ngx_event_init[]) (int max_connections, ngx_log_t *log) = { 33 static int (*ngx_event_init[]) (int max_connections, ngx_log_t *log) = {
33 ngx_select_init, 34 ngx_select_init,
34 #if (HAVE_POLL) 35 #if (HAVE_POLL)
35 ngx_poll_init, 36 ngx_poll_init,
36 #endif 37 #endif
37 #if (HAVE_KQUEUE) 38 #if (HAVE_KQUEUE)
48 ngx_listen_t *s; 49 ngx_listen_t *s;
49 50
50 /* STUB */ 51 /* STUB */
51 int max_connections = 512; 52 int max_connections = 512;
52 53
53 ngx_init_events(max_connections, log); 54 if (ngx_init_events(max_connections, log) == NGX_ERROR)
55 exit(1);
54 56
55 ngx_connections = ngx_alloc(sizeof(ngx_connection_t) 57 ngx_connections = ngx_alloc(sizeof(ngx_connection_t)
56 * max_connections, log); 58 * max_connections, log);
57 ngx_read_events = ngx_alloc(sizeof(ngx_event_t) * max_connections, log); 59 ngx_read_events = ngx_alloc(sizeof(ngx_event_t) * max_connections, log);
58 ngx_write_events = ngx_alloc(sizeof(ngx_event_t) * max_connections, log); 60 ngx_write_events = ngx_alloc(sizeof(ngx_event_t) * max_connections, log);