]> git.kaiwu.me - nginx.git/commitdiff
Removed unix ngx_threaded and related ngx_process_changes.
authorRuslan Ermilov <ru@nginx.com>
Fri, 20 Mar 2015 03:43:19 +0000 (06:43 +0300)
committerRuslan Ermilov <ru@nginx.com>
Fri, 20 Mar 2015 03:43:19 +0000 (06:43 +0300)
14 files changed:
src/event/modules/ngx_aio_module.c
src/event/modules/ngx_devpoll_module.c
src/event/modules/ngx_epoll_module.c
src/event/modules/ngx_eventport_module.c
src/event/modules/ngx_iocp_module.c
src/event/modules/ngx_kqueue_module.c
src/event/modules/ngx_poll_module.c
src/event/modules/ngx_rtsig_module.c
src/event/modules/ngx_select_module.c
src/event/modules/ngx_win32_select_module.c
src/event/ngx_event.c
src/event/ngx_event.h
src/os/unix/ngx_process_cycle.c
src/os/unix/ngx_process_cycle.h

index 5df58d24ca1955756be33a6dd2c039f0fc270bc2..fd03fecb4ffd135633e760030b24f1068563ea06 100644 (file)
@@ -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 */
index f651c9a5638903fe281bcb2d77e480cc90f6d5a5..fa8aebdf422d46c44e7742938b641ab35eee60e2 100644 (file)
@@ -89,7 +89,6 @@ ngx_event_module_t  ngx_devpoll_module_ctx = {
         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 */
index addb4477be65135fd05aaad6e1412ee1c7ff4380..5f7f67859e6b94c6d96e9fa6a1f6f7d37597e8ee 100644 (file)
@@ -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 */
index 0ab459ee82098ad276b75f01967bf36b5e76a778..bacbb05075f081d5eec7933b0286b8eb5d2b0cd9 100644 (file)
@@ -182,7 +182,6 @@ ngx_event_module_t  ngx_eventport_module_ctx = {
         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 */
index 2ddf6ea71eff9cb6730f8227228b467c17f04a18..7514e6fa511eaba9a1843eaab6ba09e25bf2f614 100644 (file)
@@ -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 */
index 986687b0af85eea68919758b8b1411bfe1f53157..5573cb2117869da7744822621061e133e4a77316 100644 (file)
@@ -30,7 +30,6 @@ static ngx_int_t ngx_kqueue_set_event(ngx_event_t *ev, ngx_int_t filter,
 #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_cycle_t *cycle, void *conf);
 
 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_ctx = {
 #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_msec_t timer)
             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 *cycle, ngx_msec_t timer,
     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 *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
 ngx_kqueue_dump_event(ngx_log_t *log, struct kevent *kev)
 {
index b96c90874b27b1105b9c0687b7359bd13aa82d64..e48a8227ae3854fd1a48f17646ffc3be2426c53a 100644 (file)
@@ -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 */
index 3777516b4527abfc9c50723a4302ca8060edafce..b120fecde9887685dbce5f3d3ee57f1a6a83fe4d 100644 (file)
@@ -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 */
index a8bf06676e3f070a4f7147c515c02cc8367a2fec..46004e5fdf9ebafb0f1605c53883624fcc2db386 100644 (file)
@@ -48,7 +48,6 @@ ngx_event_module_t  ngx_select_module_ctx = {
         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 */
index 58b20db1e0cbdc57af0bfa8a5cdabb0cf5db17c5..c671f836b132efffc382b835b95d29b1932b94da 100644 (file)
@@ -49,7 +49,6 @@ ngx_event_module_t  ngx_select_module_ctx = {
         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 */
index 2a23d5038131d04b8e525e1edd5e9259bec907fc..885528aaea2c2841581b5b001f4677e12a1a9cd1 100644 (file)
@@ -178,7 +178,7 @@ ngx_event_module_t  ngx_event_core_module_ctx = {
     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 }
 };
 
 
index 61ebcb089cbd0cc91687f74e6cf2111b3e7237c0..fbd91fb0d875c31b2f6902994da59d4bd2b5a4ea 100644 (file)
@@ -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_actions;
 #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
 
index beee6d44fd90943a72af01224bceed0fbed45933..1d5e700a8f1a3d3e22530afcc781c146bbc29796 100644 (file)
@@ -30,7 +30,6 @@ static void ngx_cache_loader_process_handler(ngx_event_t *ev);
 
 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;
index 94747b85d554f308cfbf0bdebce12d0b5a6fd51c..d44c377ce739630cc26de6de3e5b4ee317c7fc1f 100644 (file)
@@ -43,7 +43,6 @@ extern ngx_pid_t       ngx_pid;
 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;