NULL, /* add an connection */
ngx_aio_del_connection, /* delete an connection */
NULL, /* trigger a notify */
- NULL, /* process the changes */
ngx_aio_process_events, /* process the events */
ngx_aio_init, /* init the events */
ngx_aio_done /* done the events */
NULL, /* add an connection */
NULL, /* delete an connection */
NULL, /* trigger a notify */
- NULL, /* process the changes */
ngx_devpoll_process_events, /* process the events */
ngx_devpoll_init, /* init the events */
ngx_devpoll_done, /* done the events */
#else
NULL, /* trigger a notify */
#endif
- NULL, /* process the changes */
ngx_epoll_process_events, /* process the events */
ngx_epoll_init, /* init the events */
ngx_epoll_done, /* done the events */
NULL, /* add an connection */
NULL, /* delete an connection */
ngx_eventport_notify, /* trigger a notify */
- NULL, /* process the changes */
ngx_eventport_process_events, /* process the events */
ngx_eventport_init, /* init the events */
ngx_eventport_done, /* done the events */
NULL, /* add an connection */
ngx_iocp_del_connection, /* delete an connection */
NULL, /* trigger a notify */
- NULL, /* process the changes */
ngx_iocp_process_events, /* process the events */
ngx_iocp_init, /* init the events */
ngx_iocp_done /* done the events */
#ifdef EVFILT_USER
static ngx_int_t ngx_kqueue_notify(ngx_event_handler_pt handler);
#endif
-static ngx_int_t ngx_kqueue_process_changes(ngx_cycle_t *cycle, ngx_uint_t try);
static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_uint_t flags);
static ngx_inline void ngx_kqueue_dump_event(ngx_log_t *log,
int ngx_kqueue = -1;
-/*
- * The "change_list" should be declared as ngx_thread_volatile.
- * However, the use of the change_list is localized in kqueue functions and
- * is protected by the mutex so even the "icc -ipo" should not build the code
- * with the race condition. Thus we avoid the declaration to make a more
- * readable code.
- */
-
-static struct kevent *change_list, *change_list0, *change_list1;
+static struct kevent *change_list;
static struct kevent *event_list;
static ngx_uint_t max_changes, nchanges, nevents;
#else
NULL, /* trigger a notify */
#endif
- ngx_kqueue_process_changes, /* process the changes */
ngx_kqueue_process_events, /* process the events */
ngx_kqueue_init, /* init the events */
ngx_kqueue_done /* done the events */
nchanges = 0;
}
- if (change_list0) {
- ngx_free(change_list0);
+ if (change_list) {
+ ngx_free(change_list);
}
- change_list0 = ngx_alloc(kcf->changes * sizeof(struct kevent),
- cycle->log);
- if (change_list0 == NULL) {
+ change_list = ngx_alloc(kcf->changes * sizeof(struct kevent),
+ cycle->log);
+ if (change_list == NULL) {
return NGX_ERROR;
}
-
- if (change_list1) {
- ngx_free(change_list1);
- }
-
- change_list1 = ngx_alloc(kcf->changes * sizeof(struct kevent),
- cycle->log);
- if (change_list1 == NULL) {
- return NGX_ERROR;
- }
-
- change_list = change_list0;
}
max_changes = kcf->changes;
ngx_kqueue = -1;
- ngx_free(change_list1);
- ngx_free(change_list0);
+ ngx_free(change_list);
ngx_free(event_list);
- change_list1 = NULL;
- change_list0 = NULL;
change_list = NULL;
event_list = NULL;
max_changes = 0;
ngx_queue_t *queue;
struct timespec ts, *tp;
- if (ngx_threaded) {
- if (ngx_kqueue_process_changes(cycle, 0) == NGX_ERROR) {
- return NGX_ERROR;
- }
-
- n = 0;
-
- } else {
- n = (int) nchanges;
- nchanges = 0;
- }
+ n = (int) nchanges;
+ nchanges = 0;
if (timer == NGX_TIMER_INFINITE) {
tp = NULL;
}
-static ngx_int_t
-ngx_kqueue_process_changes(ngx_cycle_t *cycle, ngx_uint_t try)
-{
- int n;
- ngx_int_t rc;
- ngx_err_t err;
- struct timespec ts;
- struct kevent *changes;
-
- if (nchanges == 0) {
- return NGX_OK;
- }
-
- changes = change_list;
- if (change_list == change_list0) {
- change_list = change_list1;
- } else {
- change_list = change_list0;
- }
-
- n = (int) nchanges;
- nchanges = 0;
-
- ts.tv_sec = 0;
- ts.tv_nsec = 0;
-
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
- "kevent changes: %d", n);
-
- if (kevent(ngx_kqueue, changes, n, NULL, 0, &ts) == -1) {
- err = ngx_errno;
- ngx_log_error((err == NGX_EINTR) ? NGX_LOG_INFO : NGX_LOG_ALERT,
- cycle->log, err, "kevent() failed");
- rc = NGX_ERROR;
-
- } else {
- rc = NGX_OK;
- }
-
- return rc;
-}
-
-
static ngx_inline void
ngx_kqueue_dump_event(ngx_log_t *log, struct kevent *kev)
{
NULL, /* add an connection */
NULL, /* delete an connection */
NULL, /* trigger a notify */
- NULL, /* process the changes */
ngx_poll_process_events, /* process the events */
ngx_poll_init, /* init the events */
ngx_poll_done /* done the events */
ngx_rtsig_add_connection, /* add an connection */
ngx_rtsig_del_connection, /* delete an connection */
NULL, /* trigger a notify */
- NULL, /* process the changes */
ngx_rtsig_process_events, /* process the events */
ngx_rtsig_init, /* init the events */
ngx_rtsig_done, /* done the events */
NULL, /* add an connection */
NULL, /* delete an connection */
NULL, /* trigger a notify */
- NULL, /* process the changes */
ngx_select_process_events, /* process the events */
ngx_select_init, /* init the events */
ngx_select_done /* done the events */
NULL, /* add an connection */
NULL, /* delete an connection */
NULL, /* trigger a notify */
- NULL, /* process the changes */
ngx_select_process_events, /* process the events */
ngx_select_init, /* init the events */
ngx_select_done /* done the events */
ngx_event_core_create_conf, /* create configuration */
ngx_event_core_init_conf, /* init configuration */
- { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+ { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
ngx_int_t (*notify)(ngx_event_handler_pt handler);
- ngx_int_t (*process_changes)(ngx_cycle_t *cycle, ngx_uint_t nowait);
ngx_int_t (*process_events)(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_uint_t flags);
#endif
-#define ngx_process_changes ngx_event_actions.process_changes
#define ngx_process_events ngx_event_actions.process_events
#define ngx_done_events ngx_event_actions.done
ngx_uint_t ngx_process;
ngx_pid_t ngx_pid;
-ngx_uint_t ngx_threaded;
sig_atomic_t ngx_reap;
sig_atomic_t ngx_sigio;
extern ngx_pid_t ngx_new_binary;
extern ngx_uint_t ngx_inherited;
extern ngx_uint_t ngx_daemonized;
-extern ngx_uint_t ngx_threaded;
extern ngx_uint_t ngx_exiting;
extern sig_atomic_t ngx_reap;