Removed unix ngx_threaded and related ngx_process_changes.

This commit is contained in:
Ruslan Ermilov 2015-03-20 06:43:19 +03:00
parent d1ec868e32
commit b6029a8a3f
14 changed files with 10 additions and 100 deletions

View File

@ -49,7 +49,6 @@ ngx_event_module_t ngx_aio_module_ctx = {
NULL, /* add an connection */ NULL, /* add an connection */
ngx_aio_del_connection, /* delete an connection */ ngx_aio_del_connection, /* delete an connection */
NULL, /* trigger a notify */ NULL, /* trigger a notify */
NULL, /* process the changes */
ngx_aio_process_events, /* process the events */ ngx_aio_process_events, /* process the events */
ngx_aio_init, /* init the events */ ngx_aio_init, /* init the events */
ngx_aio_done /* done the events */ ngx_aio_done /* done the events */

View File

@ -89,7 +89,6 @@ ngx_event_module_t ngx_devpoll_module_ctx = {
NULL, /* add an connection */ NULL, /* add an connection */
NULL, /* delete an connection */ NULL, /* delete an connection */
NULL, /* trigger a notify */ NULL, /* trigger a notify */
NULL, /* process the changes */
ngx_devpoll_process_events, /* process the events */ ngx_devpoll_process_events, /* process the events */
ngx_devpoll_init, /* init the events */ ngx_devpoll_init, /* init the events */
ngx_devpoll_done, /* done the events */ ngx_devpoll_done, /* done the events */

View File

@ -185,7 +185,6 @@ ngx_event_module_t ngx_epoll_module_ctx = {
#else #else
NULL, /* trigger a notify */ NULL, /* trigger a notify */
#endif #endif
NULL, /* process the changes */
ngx_epoll_process_events, /* process the events */ ngx_epoll_process_events, /* process the events */
ngx_epoll_init, /* init the events */ ngx_epoll_init, /* init the events */
ngx_epoll_done, /* done the events */ ngx_epoll_done, /* done the events */

View File

@ -182,7 +182,6 @@ ngx_event_module_t ngx_eventport_module_ctx = {
NULL, /* add an connection */ NULL, /* add an connection */
NULL, /* delete an connection */ NULL, /* delete an connection */
ngx_eventport_notify, /* trigger a notify */ ngx_eventport_notify, /* trigger a notify */
NULL, /* process the changes */
ngx_eventport_process_events, /* process the events */ ngx_eventport_process_events, /* process the events */
ngx_eventport_init, /* init the events */ ngx_eventport_init, /* init the events */
ngx_eventport_done, /* done the events */ ngx_eventport_done, /* done the events */

View File

@ -65,7 +65,6 @@ ngx_event_module_t ngx_iocp_module_ctx = {
NULL, /* add an connection */ NULL, /* add an connection */
ngx_iocp_del_connection, /* delete an connection */ ngx_iocp_del_connection, /* delete an connection */
NULL, /* trigger a notify */ NULL, /* trigger a notify */
NULL, /* process the changes */
ngx_iocp_process_events, /* process the events */ ngx_iocp_process_events, /* process the events */
ngx_iocp_init, /* init the events */ ngx_iocp_init, /* init the events */
ngx_iocp_done /* done the events */ ngx_iocp_done /* done the events */

View File

@ -30,7 +30,6 @@ static ngx_int_t ngx_kqueue_set_event(ngx_event_t *ev, ngx_int_t filter,
#ifdef EVFILT_USER #ifdef EVFILT_USER
static ngx_int_t ngx_kqueue_notify(ngx_event_handler_pt handler); static ngx_int_t ngx_kqueue_notify(ngx_event_handler_pt handler);
#endif #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, static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_uint_t flags); ngx_uint_t flags);
static ngx_inline void ngx_kqueue_dump_event(ngx_log_t *log, static ngx_inline void ngx_kqueue_dump_event(ngx_log_t *log,
@ -42,15 +41,7 @@ static char *ngx_kqueue_init_conf(ngx_cycle_t *cycle, void *conf);
int ngx_kqueue = -1; int ngx_kqueue = -1;
/* static struct kevent *change_list;
* 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 *event_list; static struct kevent *event_list;
static ngx_uint_t max_changes, nchanges, nevents; static ngx_uint_t max_changes, nchanges, nevents;
@ -99,7 +90,6 @@ ngx_event_module_t ngx_kqueue_module_ctx = {
#else #else
NULL, /* trigger a notify */ NULL, /* trigger a notify */
#endif #endif
ngx_kqueue_process_changes, /* process the changes */
ngx_kqueue_process_events, /* process the events */ ngx_kqueue_process_events, /* process the events */
ngx_kqueue_init, /* init the events */ ngx_kqueue_init, /* init the events */
ngx_kqueue_done /* done the events */ ngx_kqueue_done /* done the events */
@ -165,27 +155,15 @@ ngx_kqueue_init(ngx_cycle_t *cycle, ngx_msec_t timer)
nchanges = 0; nchanges = 0;
} }
if (change_list0) { if (change_list) {
ngx_free(change_list0); ngx_free(change_list);
} }
change_list0 = ngx_alloc(kcf->changes * sizeof(struct kevent), change_list = ngx_alloc(kcf->changes * sizeof(struct kevent),
cycle->log); cycle->log);
if (change_list0 == NULL) { if (change_list == NULL) {
return NGX_ERROR; 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; max_changes = kcf->changes;
@ -290,12 +268,9 @@ ngx_kqueue_done(ngx_cycle_t *cycle)
ngx_kqueue = -1; ngx_kqueue = -1;
ngx_free(change_list1); ngx_free(change_list);
ngx_free(change_list0);
ngx_free(event_list); ngx_free(event_list);
change_list1 = NULL;
change_list0 = NULL;
change_list = NULL; change_list = NULL;
event_list = NULL; event_list = NULL;
max_changes = 0; max_changes = 0;
@ -531,17 +506,8 @@ ngx_kqueue_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_queue_t *queue; ngx_queue_t *queue;
struct timespec ts, *tp; 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; n = (int) nchanges;
nchanges = 0; nchanges = 0;
}
if (timer == NGX_TIMER_INFINITE) { if (timer == NGX_TIMER_INFINITE) {
tp = NULL; tp = NULL;
@ -707,49 +673,6 @@ ngx_kqueue_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
} }
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 static ngx_inline void
ngx_kqueue_dump_event(ngx_log_t *log, struct kevent *kev) ngx_kqueue_dump_event(ngx_log_t *log, struct kevent *kev)
{ {

View File

@ -40,7 +40,6 @@ ngx_event_module_t ngx_poll_module_ctx = {
NULL, /* add an connection */ NULL, /* add an connection */
NULL, /* delete an connection */ NULL, /* delete an connection */
NULL, /* trigger a notify */ NULL, /* trigger a notify */
NULL, /* process the changes */
ngx_poll_process_events, /* process the events */ ngx_poll_process_events, /* process the events */
ngx_poll_init, /* init the events */ ngx_poll_init, /* init the events */
ngx_poll_done /* done the events */ ngx_poll_done /* done the events */

View File

@ -131,7 +131,6 @@ ngx_event_module_t ngx_rtsig_module_ctx = {
ngx_rtsig_add_connection, /* add an connection */ ngx_rtsig_add_connection, /* add an connection */
ngx_rtsig_del_connection, /* delete an connection */ ngx_rtsig_del_connection, /* delete an connection */
NULL, /* trigger a notify */ NULL, /* trigger a notify */
NULL, /* process the changes */
ngx_rtsig_process_events, /* process the events */ ngx_rtsig_process_events, /* process the events */
ngx_rtsig_init, /* init the events */ ngx_rtsig_init, /* init the events */
ngx_rtsig_done, /* done the events */ ngx_rtsig_done, /* done the events */

View File

@ -48,7 +48,6 @@ ngx_event_module_t ngx_select_module_ctx = {
NULL, /* add an connection */ NULL, /* add an connection */
NULL, /* delete an connection */ NULL, /* delete an connection */
NULL, /* trigger a notify */ NULL, /* trigger a notify */
NULL, /* process the changes */
ngx_select_process_events, /* process the events */ ngx_select_process_events, /* process the events */
ngx_select_init, /* init the events */ ngx_select_init, /* init the events */
ngx_select_done /* done the events */ ngx_select_done /* done the events */

View File

@ -49,7 +49,6 @@ ngx_event_module_t ngx_select_module_ctx = {
NULL, /* add an connection */ NULL, /* add an connection */
NULL, /* delete an connection */ NULL, /* delete an connection */
NULL, /* trigger a notify */ NULL, /* trigger a notify */
NULL, /* process the changes */
ngx_select_process_events, /* process the events */ ngx_select_process_events, /* process the events */
ngx_select_init, /* init the events */ ngx_select_init, /* init the events */
ngx_select_done /* done the events */ ngx_select_done /* done the events */

View File

@ -178,7 +178,7 @@ ngx_event_module_t ngx_event_core_module_ctx = {
ngx_event_core_create_conf, /* create configuration */ ngx_event_core_create_conf, /* create configuration */
ngx_event_core_init_conf, /* init 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 }
}; };

View File

@ -202,7 +202,6 @@ typedef struct {
ngx_int_t (*notify)(ngx_event_handler_pt handler); 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_int_t (*process_events)(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_uint_t flags); ngx_uint_t flags);
@ -415,7 +414,6 @@ extern ngx_event_actions_t ngx_event_actions;
#endif #endif
#define ngx_process_changes ngx_event_actions.process_changes
#define ngx_process_events ngx_event_actions.process_events #define ngx_process_events ngx_event_actions.process_events
#define ngx_done_events ngx_event_actions.done #define ngx_done_events ngx_event_actions.done

View File

@ -30,7 +30,6 @@ static void ngx_cache_loader_process_handler(ngx_event_t *ev);
ngx_uint_t ngx_process; ngx_uint_t ngx_process;
ngx_pid_t ngx_pid; ngx_pid_t ngx_pid;
ngx_uint_t ngx_threaded;
sig_atomic_t ngx_reap; sig_atomic_t ngx_reap;
sig_atomic_t ngx_sigio; sig_atomic_t ngx_sigio;

View File

@ -43,7 +43,6 @@ extern ngx_pid_t ngx_pid;
extern ngx_pid_t ngx_new_binary; extern ngx_pid_t ngx_new_binary;
extern ngx_uint_t ngx_inherited; extern ngx_uint_t ngx_inherited;
extern ngx_uint_t ngx_daemonized; extern ngx_uint_t ngx_daemonized;
extern ngx_uint_t ngx_threaded;
extern ngx_uint_t ngx_exiting; extern ngx_uint_t ngx_exiting;
extern sig_atomic_t ngx_reap; extern sig_atomic_t ngx_reap;