[nginx] Removed unix ngx_threaded and related ngx_process_changes.
Ruslan Ermilov
ru at nginx.com
Fri Mar 20 03:46:37 UTC 2015
details: http://hg.nginx.org/nginx/rev/4652f8f26b12
branches:
changeset: 6030:4652f8f26b12
user: Ruslan Ermilov <ru at nginx.com>
date: Fri Mar 20 06:43:19 2015 +0300
description:
Removed unix ngx_threaded and related ngx_process_changes.
diffstat:
src/event/modules/ngx_aio_module.c | 1 -
src/event/modules/ngx_devpoll_module.c | 1 -
src/event/modules/ngx_epoll_module.c | 1 -
src/event/modules/ngx_eventport_module.c | 1 -
src/event/modules/ngx_iocp_module.c | 1 -
src/event/modules/ngx_kqueue_module.c | 95 ++--------------------------
src/event/modules/ngx_poll_module.c | 1 -
src/event/modules/ngx_rtsig_module.c | 1 -
src/event/modules/ngx_select_module.c | 1 -
src/event/modules/ngx_win32_select_module.c | 1 -
src/event/ngx_event.c | 2 +-
src/event/ngx_event.h | 2 -
src/os/unix/ngx_process_cycle.c | 1 -
src/os/unix/ngx_process_cycle.h | 1 -
14 files changed, 10 insertions(+), 100 deletions(-)
diffs (truncated from 305 to 300 lines):
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/modules/ngx_aio_module.c
--- a/src/event/modules/ngx_aio_module.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/modules/ngx_aio_module.c Fri Mar 20 06:43:19 2015 +0300
@@ -49,7 +49,6 @@ ngx_event_module_t ngx_aio_module_ctx =
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 */
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/modules/ngx_devpoll_module.c
--- a/src/event/modules/ngx_devpoll_module.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/modules/ngx_devpoll_module.c Fri Mar 20 06:43:19 2015 +0300
@@ -89,7 +89,6 @@ ngx_event_module_t ngx_devpoll_module_c
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 */
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/modules/ngx_epoll_module.c
--- a/src/event/modules/ngx_epoll_module.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/modules/ngx_epoll_module.c Fri Mar 20 06:43:19 2015 +0300
@@ -185,7 +185,6 @@ ngx_event_module_t ngx_epoll_module_ctx
#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 */
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/modules/ngx_eventport_module.c
--- a/src/event/modules/ngx_eventport_module.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/modules/ngx_eventport_module.c Fri Mar 20 06:43:19 2015 +0300
@@ -182,7 +182,6 @@ ngx_event_module_t ngx_eventport_module
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 */
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/modules/ngx_iocp_module.c
--- a/src/event/modules/ngx_iocp_module.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/modules/ngx_iocp_module.c Fri Mar 20 06:43:19 2015 +0300
@@ -65,7 +65,6 @@ ngx_event_module_t ngx_iocp_module_ctx
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 */
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/modules/ngx_kqueue_module.c
--- a/src/event/modules/ngx_kqueue_module.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/modules/ngx_kqueue_module.c Fri Mar 20 06:43:19 2015 +0300
@@ -30,7 +30,6 @@ static ngx_int_t ngx_kqueue_set_event(ng
#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,
@@ -42,15 +41,7 @@ static char *ngx_kqueue_init_conf(ngx_cy
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;
@@ -99,7 +90,6 @@ ngx_event_module_t ngx_kqueue_module_ct
#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 */
@@ -165,27 +155,15 @@ ngx_kqueue_init(ngx_cycle_t *cycle, ngx_
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;
@@ -290,12 +268,9 @@ ngx_kqueue_done(ngx_cycle_t *cycle)
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;
@@ -531,17 +506,8 @@ ngx_kqueue_process_events(ngx_cycle_t *c
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;
@@ -707,49 +673,6 @@ ngx_kqueue_process_events(ngx_cycle_t *c
}
-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)
{
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/modules/ngx_poll_module.c
--- a/src/event/modules/ngx_poll_module.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/modules/ngx_poll_module.c Fri Mar 20 06:43:19 2015 +0300
@@ -40,7 +40,6 @@ ngx_event_module_t ngx_poll_module_ctx
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 */
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/modules/ngx_rtsig_module.c
--- a/src/event/modules/ngx_rtsig_module.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/modules/ngx_rtsig_module.c Fri Mar 20 06:43:19 2015 +0300
@@ -131,7 +131,6 @@ ngx_event_module_t ngx_rtsig_module_ctx
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 */
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/modules/ngx_select_module.c
--- a/src/event/modules/ngx_select_module.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/modules/ngx_select_module.c Fri Mar 20 06:43:19 2015 +0300
@@ -48,7 +48,6 @@ ngx_event_module_t ngx_select_module_ct
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 */
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/modules/ngx_win32_select_module.c
--- a/src/event/modules/ngx_win32_select_module.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/modules/ngx_win32_select_module.c Fri Mar 20 06:43:19 2015 +0300
@@ -49,7 +49,6 @@ ngx_event_module_t ngx_select_module_ct
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 */
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/ngx_event.c
--- a/src/event/ngx_event.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/ngx_event.c Fri Mar 20 06:43:19 2015 +0300
@@ -178,7 +178,7 @@ ngx_event_module_t ngx_event_core_modul
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 }
};
diff -r e284f3ff6831 -r 4652f8f26b12 src/event/ngx_event.h
--- a/src/event/ngx_event.h Fri Mar 20 06:43:19 2015 +0300
+++ b/src/event/ngx_event.h Fri Mar 20 06:43:19 2015 +0300
@@ -202,7 +202,6 @@ typedef struct {
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);
@@ -415,7 +414,6 @@ extern ngx_event_actions_t ngx_event_a
#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
diff -r e284f3ff6831 -r 4652f8f26b12 src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c Fri Mar 20 06:43:19 2015 +0300
+++ b/src/os/unix/ngx_process_cycle.c Fri Mar 20 06:43:19 2015 +0300
@@ -30,7 +30,6 @@ static void ngx_cache_loader_process_han
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;
diff -r e284f3ff6831 -r 4652f8f26b12 src/os/unix/ngx_process_cycle.h
--- a/src/os/unix/ngx_process_cycle.h Fri Mar 20 06:43:19 2015 +0300
+++ b/src/os/unix/ngx_process_cycle.h Fri Mar 20 06:43:19 2015 +0300
@@ -43,7 +43,6 @@ extern ngx_pid_t ngx_pid;
extern ngx_pid_t ngx_new_binary;
extern ngx_uint_t ngx_inherited;
More information about the nginx-devel
mailing list