[nginx] Renamed NGX_THREADS to NGX_OLD_THREADS because of deprec...

Valentin Bartenev vbart at nginx.com
Wed Mar 18 15:57:45 UTC 2015


details:   http://hg.nginx.org/nginx/rev/457ec43dd8d5
branches:  
changeset: 6016:457ec43dd8d5
user:      Ruslan Ermilov <ru at nginx.com>
date:      Wed Mar 04 18:26:25 2015 +0300
description:
Renamed NGX_THREADS to NGX_OLD_THREADS because of deprecation.

It's mostly dead code and the original idea of worker threads has been rejected.

diffstat:

 src/core/nginx.c                      |   6 +++---
 src/core/ngx_connection.c             |   2 +-
 src/core/ngx_connection.h             |   2 +-
 src/core/ngx_cycle.c                  |   2 +-
 src/core/ngx_cycle.h                  |   8 ++++++--
 src/core/ngx_regex.c                  |   6 +++---
 src/core/ngx_spinlock.c               |   2 +-
 src/event/modules/ngx_kqueue_module.c |   6 +++---
 src/event/modules/ngx_poll_module.c   |   2 +-
 src/event/modules/ngx_select_module.c |   2 +-
 src/event/ngx_event.c                 |   4 ++--
 src/event/ngx_event_busy_lock.h       |   2 +-
 src/event/ngx_event_connect.h         |   2 +-
 src/event/ngx_event_mutex.c           |   2 +-
 src/http/ngx_http_upstream.c          |   2 +-
 src/os/unix/ngx_process_cycle.c       |  10 +++++-----
 src/os/unix/ngx_thread.h              |   4 ++--
 src/os/unix/ngx_user.c                |   8 ++++----
 src/os/win32/ngx_win32_config.h       |   2 +-
 19 files changed, 39 insertions(+), 35 deletions(-)

diffs (truncated from 386 to 300 lines):

diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/core/nginx.c
--- a/src/core/nginx.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/core/nginx.c	Wed Mar 04 18:26:25 2015 +0300
@@ -139,7 +139,7 @@ static ngx_command_t  ngx_core_commands[
       0,
       NULL },
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
     { ngx_string("worker_threads"),
       NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
@@ -959,7 +959,7 @@ ngx_core_module_create_conf(ngx_cycle_t 
     ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT;
     ccf->group = (ngx_gid_t) NGX_CONF_UNSET_UINT;
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     ccf->worker_threads = NGX_CONF_UNSET;
     ccf->thread_stack_size = NGX_CONF_UNSET_SIZE;
 #endif
@@ -1000,7 +1000,7 @@ ngx_core_module_init_conf(ngx_cycle_t *c
 
 #endif
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
     ngx_conf_init_value(ccf->worker_threads, 0);
     ngx_threads_n = ccf->worker_threads;
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/core/ngx_connection.c
--- a/src/core/ngx_connection.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/core/ngx_connection.c	Wed Mar 04 18:26:25 2015 +0300
@@ -943,7 +943,7 @@ ngx_close_connection(ngx_connection_t *c
         }
     }
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
     /*
      * we have to clean the connection information before the closing
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/core/ngx_connection.h
--- a/src/core/ngx_connection.h	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/core/ngx_connection.h	Wed Mar 04 18:26:25 2015 +0300
@@ -184,7 +184,7 @@ struct ngx_connection_s {
     unsigned            busy_count:2;
 #endif
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     ngx_atomic_t        lock;
 #endif
 };
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/core/ngx_cycle.c
--- a/src/core/ngx_cycle.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/core/ngx_cycle.c	Wed Mar 04 18:26:25 2015 +0300
@@ -26,7 +26,7 @@ static ngx_event_t     ngx_cleaner_event
 ngx_uint_t             ngx_test_config;
 ngx_uint_t             ngx_quiet_mode;
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 ngx_tls_key_t          ngx_core_tls_key;
 #endif
 
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/core/ngx_cycle.h
--- a/src/core/ngx_cycle.h	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/core/ngx_cycle.h	Wed Mar 04 18:26:25 2015 +0300
@@ -103,7 +103,7 @@ typedef struct {
      ngx_array_t              env;
      char                   **environment;
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
      ngx_int_t                worker_threads;
      size_t                   thread_stack_size;
 #endif
@@ -111,10 +111,14 @@ typedef struct {
 } ngx_core_conf_t;
 
 
+#if (NGX_OLD_THREADS)
+
 typedef struct {
      ngx_pool_t              *pool;   /* pcre's malloc() pool */
 } ngx_core_tls_t;
 
+#endif
+
 
 #define ngx_is_init_cycle(cycle)  (cycle->conf_ctx == NULL)
 
@@ -136,7 +140,7 @@ extern ngx_array_t            ngx_old_cy
 extern ngx_module_t           ngx_core_module;
 extern ngx_uint_t             ngx_test_config;
 extern ngx_uint_t             ngx_quiet_mode;
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 extern ngx_tls_key_t          ngx_core_tls_key;
 #endif
 
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/core/ngx_regex.c
--- a/src/core/ngx_regex.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/core/ngx_regex.c	Wed Mar 04 18:26:25 2015 +0300
@@ -80,7 +80,7 @@ ngx_regex_init(void)
 static ngx_inline void
 ngx_regex_malloc_init(ngx_pool_t *pool)
 {
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     ngx_core_tls_t  *tls;
 
     if (ngx_threaded) {
@@ -98,7 +98,7 @@ ngx_regex_malloc_init(ngx_pool_t *pool)
 static ngx_inline void
 ngx_regex_malloc_done(void)
 {
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     ngx_core_tls_t  *tls;
 
     if (ngx_threaded) {
@@ -253,7 +253,7 @@ static void * ngx_libc_cdecl
 ngx_regex_malloc(size_t size)
 {
     ngx_pool_t      *pool;
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     ngx_core_tls_t  *tls;
 
     if (ngx_threaded) {
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/core/ngx_spinlock.c
--- a/src/core/ngx_spinlock.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/core/ngx_spinlock.c	Wed Mar 04 18:26:25 2015 +0300
@@ -42,7 +42,7 @@ ngx_spinlock(ngx_atomic_t *lock, ngx_ato
 
 #else
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
 #error ngx_spinlock() or ngx_atomic_cmp_set() are not defined !
 
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/event/modules/ngx_kqueue_module.c
--- a/src/event/modules/ngx_kqueue_module.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/event/modules/ngx_kqueue_module.c	Wed Mar 04 18:26:25 2015 +0300
@@ -48,7 +48,7 @@ static struct kevent  *change_list, *cha
 static struct kevent  *event_list;
 static ngx_uint_t      max_changes, nchanges, nevents;
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 static ngx_mutex_t    *list_mutex;
 static ngx_mutex_t    *kevent_mutex;
 #endif
@@ -133,7 +133,7 @@ ngx_kqueue_init(ngx_cycle_t *cycle, ngx_
             return NGX_ERROR;
         }
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
         list_mutex = ngx_mutex_init(cycle->log, 0);
         if (list_mutex == NULL) {
@@ -257,7 +257,7 @@ ngx_kqueue_done(ngx_cycle_t *cycle)
 
     ngx_kqueue = -1;
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     ngx_mutex_destroy(kevent_mutex);
     ngx_mutex_destroy(list_mutex);
 #endif
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/event/modules/ngx_poll_module.c
--- a/src/event/modules/ngx_poll_module.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/event/modules/ngx_poll_module.c	Wed Mar 04 18:26:25 2015 +0300
@@ -413,7 +413,7 @@ ngx_poll_init_conf(ngx_cycle_t *cycle, v
         return NGX_CONF_OK;
     }
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
     ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
                   "poll() is not supported in the threaded mode");
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/event/modules/ngx_select_module.c
--- a/src/event/modules/ngx_select_module.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/event/modules/ngx_select_module.c	Wed Mar 04 18:26:25 2015 +0300
@@ -419,7 +419,7 @@ ngx_select_init_conf(ngx_cycle_t *cycle,
         return NGX_CONF_ERROR;
     }
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
     ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
                   "select() is not supported in the threaded mode");
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/event/ngx_event.c
--- a/src/event/ngx_event.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/event/ngx_event.c	Wed Mar 04 18:26:25 2015 +0300
@@ -212,7 +212,7 @@ ngx_process_events_and_timers(ngx_cycle_
         timer = ngx_event_find_timer();
         flags = NGX_UPDATE_TIME;
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
         if (timer == NGX_TIMER_INFINITE || timer > 500) {
             timer = 500;
@@ -722,7 +722,7 @@ ngx_event_process_init(ngx_cycle_t *cycl
 
         next = &c[i];
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
         c[i].lock = 0;
 #endif
     } while (i);
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/event/ngx_event_busy_lock.h
--- a/src/event/ngx_event_busy_lock.h	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/event/ngx_event_busy_lock.h	Wed Mar 04 18:26:25 2015 +0300
@@ -46,7 +46,7 @@ typedef struct {
     ngx_event_busy_lock_ctx_t  *events;
     ngx_event_busy_lock_ctx_t  *last;
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     ngx_mutex_t                *mutex;
 #endif
 } ngx_event_busy_lock_t;
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/event/ngx_event_connect.h
--- a/src/event/ngx_event_connect.h	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/event/ngx_event_connect.h	Wed Mar 04 18:26:25 2015 +0300
@@ -53,7 +53,7 @@ struct ngx_peer_connection_s {
     ngx_event_save_peer_session_pt   save_session;
 #endif
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     ngx_atomic_t                    *lock;
 #endif
 
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/event/ngx_event_mutex.c
--- a/src/event/ngx_event_mutex.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/event/ngx_event_mutex.c	Wed Mar 04 18:26:25 2015 +0300
@@ -28,7 +28,7 @@ ngx_int_t ngx_event_mutex_timedlock(ngx_
         m->last = ev;
         ev->next = NULL;
 
-#if (NGX_THREADS0)
+#if (NGX_OLD_THREADS0)
         ev->light = 1;
 #endif
 
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/http/ngx_http_upstream.c	Wed Mar 04 18:26:25 2015 +0300
@@ -446,7 +446,7 @@ ngx_http_upstream_create(ngx_http_reques
 
     u->peer.log = r->connection->log;
     u->peer.log_error = NGX_ERROR_ERR;
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     u->peer.lock = &r->connection->lock;
 #endif
 
diff -r e11a8e7e8e0c -r 457ec43dd8d5 src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c	Wed Mar 18 02:04:39 2015 +0300
+++ b/src/os/unix/ngx_process_cycle.c	Wed Mar 04 18:26:25 2015 +0300
@@ -23,7 +23,7 @@ static void ngx_worker_process_cycle(ngx
 static void ngx_worker_process_init(ngx_cycle_t *cycle, ngx_int_t worker);
 static void ngx_worker_process_exit(ngx_cycle_t *cycle);
 static void ngx_channel_handler(ngx_event_t *ev);
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle);
 static ngx_thread_value_t ngx_worker_thread_cycle(void *data);
 #endif
@@ -56,7 +56,7 @@ ngx_uint_t    ngx_noaccepting;
 ngx_uint_t    ngx_restart;
 
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 volatile ngx_thread_t  ngx_threads[NGX_MAX_THREADS];
 ngx_int_t              ngx_threads_n;
 #endif
@@ -747,7 +747,7 @@ ngx_worker_process_cycle(ngx_cycle_t *cy
 
     ngx_setproctitle("worker process");
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     {
     ngx_int_t         n;
     ngx_err_t         err;
@@ -1032,7 +1032,7 @@ ngx_worker_process_exit(ngx_cycle_t *cyc
     ngx_uint_t         i;
     ngx_connection_t  *c;



More information about the nginx-devel mailing list