]> git.kaiwu.me - nginx.git/commitdiff
Renamed NGX_THREADS to NGX_OLD_THREADS because of deprecation.
authorRuslan Ermilov <ru@nginx.com>
Wed, 4 Mar 2015 15:26:25 +0000 (18:26 +0300)
committerRuslan Ermilov <ru@nginx.com>
Wed, 4 Mar 2015 15:26:25 +0000 (18:26 +0300)
It's mostly dead code and the original idea of worker threads has been rejected.

19 files changed:
src/core/nginx.c
src/core/ngx_connection.c
src/core/ngx_connection.h
src/core/ngx_cycle.c
src/core/ngx_cycle.h
src/core/ngx_regex.c
src/core/ngx_spinlock.c
src/event/modules/ngx_kqueue_module.c
src/event/modules/ngx_poll_module.c
src/event/modules/ngx_select_module.c
src/event/ngx_event.c
src/event/ngx_event_busy_lock.h
src/event/ngx_event_connect.h
src/event/ngx_event_mutex.c
src/http/ngx_http_upstream.c
src/os/unix/ngx_process_cycle.c
src/os/unix/ngx_thread.h
src/os/unix/ngx_user.c
src/os/win32/ngx_win32_config.h

index c75ee4fd71c3204988263cf5186c70d200055b89..feb861a116a8ad6fd4d5e84ff2d53de83a94d8e6 100644 (file)
@@ -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 *cycle)
     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 *cycle, void *conf)
 
 #endif
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
     ngx_conf_init_value(ccf->worker_threads, 0);
     ngx_threads_n = ccf->worker_threads;
index d6c0bdadcdc7217b52749e5142075e1b827197c8..896b775c56904caaf96f2853917a1750e58f439f 100644 (file)
@@ -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
index 143cab7b31f18b22731691e26aafc5cc33484740..207aea4f5e45c803fc4bb3c04273ac172e6373f5 100644 (file)
@@ -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
 };
index d69783fecf3ce9b0fed842abd704d4ee3449236c..11e413f4ea1cc1fbc4b51c756e02bc0c3cd4e2f7 100644 (file)
@@ -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
 
index 21bf5ca3f2556c15dc35b5550cc51afe5c9db84c..be90a7281d2a16adcbc4f74c06521e2d02ec3d9e 100644 (file)
@@ -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_cycles;
 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
 
index 30acca5fcece281a8a0d54e72a1abccd79cd8ccb..77c5947decc1efe0d9f95bb56280b37eff618d05 100644 (file)
@@ -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) {
index 9c93afaf1b1488ef192c7a7ea72302dac22c1553..33477e2eeddf66957c79d4aea0ac4fa4b4040bde 100644 (file)
@@ -42,7 +42,7 @@ ngx_spinlock(ngx_atomic_t *lock, ngx_atomic_int_t value, ngx_uint_t spin)
 
 #else
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
 #error ngx_spinlock() or ngx_atomic_cmp_set() are not defined !
 
index 9e7a1bdb69293811c214e6b9d40b36b9a74eb9e6..17214c5fbafb6c95c91556f1c35018d81473914d 100644 (file)
@@ -48,7 +48,7 @@ static struct kevent  *change_list, *change_list0, *change_list1;
 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_msec_t timer)
             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
index bad1a7d2a2d87e2a84022b76dbe83544ef33a3de..3617afb95e8cf395cdb51d525b1ce1410de0b13c 100644 (file)
@@ -413,7 +413,7 @@ ngx_poll_init_conf(ngx_cycle_t *cycle, void *conf)
         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");
index fa2d55ae2ac88a573f3707b9f7422bb0f4c5ccd3..e8374443106da2f0739ff6a5c247ee55f685eccf 100644 (file)
@@ -419,7 +419,7 @@ ngx_select_init_conf(ngx_cycle_t *cycle, void *conf)
         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");
index 26c3b97166961468b5197432fcae36882f7eea30..885528aaea2c2841581b5b001f4677e12a1a9cd1 100644 (file)
@@ -212,7 +212,7 @@ ngx_process_events_and_timers(ngx_cycle_t *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 *cycle)
 
         next = &c[i];
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
         c[i].lock = 0;
 #endif
     } while (i);
index 254c233e776576739a9fd314202449d1d9629b3b..a7e556cf675d660e11cfe8b130cb9c756728c9c4 100644 (file)
@@ -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;
index e73825885fc3e324dd3f1ed0b2b6b2c01c78f112..ab35836a2712bc1b5d7199b829c8aac253227264 100644 (file)
@@ -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
 
index 98efbb0d87ecb8868b2b3f84cb15ded8317f1a0c..66befe3b619eab7764a434e15b856ecde69722ce 100644 (file)
@@ -28,7 +28,7 @@ ngx_int_t ngx_event_mutex_timedlock(ngx_event_mutex_t *m, ngx_msec_t timer,
         m->last = ev;
         ev->next = NULL;
 
-#if (NGX_THREADS0)
+#if (NGX_OLD_THREADS0)
         ev->light = 1;
 #endif
 
index 70197813934af6c5955059b17162db62b0e6ce86..fcff4a4c33a8dba8af5761b437754a8cb03a6ae5 100644 (file)
@@ -446,7 +446,7 @@ ngx_http_upstream_create(ngx_http_request_t *r)
 
     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
 
index 51cf725446e5e66612b6ffbc4ab5628a6fb60dad..83d65dde696a33319cbe9cc5c04901edb0021f84 100644 (file)
@@ -23,7 +23,7 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data);
 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 *cycle, void *data)
 
     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 *cycle)
     ngx_uint_t         i;
     ngx_connection_t  *c;
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
     ngx_terminate = 1;
 
     ngx_wakeup_worker_threads(cycle);
@@ -1181,7 +1181,7 @@ ngx_channel_handler(ngx_event_t *ev)
 }
 
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
 static void
 ngx_wakeup_worker_threads(ngx_cycle_t *cycle)
index 49c5d5656a72c5c5abd10d16c7300cd366a125d5..2077b3df610767d1c08a9699180a43edd3cc0ff1 100644 (file)
@@ -12,7 +12,7 @@
 #include <ngx_config.h>
 #include <ngx_core.h>
 
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
 
 #define NGX_MAX_THREADS      128
 
@@ -107,7 +107,7 @@ ngx_int_t ngx_cond_wait(ngx_cond_t *cv, ngx_mutex_t *m);
 ngx_int_t ngx_cond_signal(ngx_cond_t *cv);
 
 
-#else /* !NGX_THREADS */
+#else /* !NGX_OLD_THREADS */
 
 #define ngx_thread_volatile
 
index 3491f1c9ea12a67eea5092966581b22e104ad018..4ac969fd9d3c6aab3ffe7156dcafb08d46862cc8 100644 (file)
@@ -64,7 +64,7 @@ ngx_libc_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
     size_t      len;
     ngx_err_t   err;
 
-#if (NGX_THREADS && NGX_NONREENTRANT_CRYPT)
+#if (NGX_OLD_THREADS && NGX_NONREENTRANT_CRYPT)
 
     /* crypt() is a time consuming function, so we only try to lock */
 
@@ -81,14 +81,14 @@ ngx_libc_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
 
         *encrypted = ngx_pnalloc(pool, len);
         if (*encrypted == NULL) {
-#if (NGX_THREADS && NGX_NONREENTRANT_CRYPT)
+#if (NGX_OLD_THREADS && NGX_NONREENTRANT_CRYPT)
             ngx_mutex_unlock(ngx_crypt_mutex);
 #endif
             return NGX_ERROR;
         }
 
         ngx_memcpy(*encrypted, value, len);
-#if (NGX_THREADS && NGX_NONREENTRANT_CRYPT)
+#if (NGX_OLD_THREADS && NGX_NONREENTRANT_CRYPT)
         ngx_mutex_unlock(ngx_crypt_mutex);
 #endif
         return NGX_OK;
@@ -96,7 +96,7 @@ ngx_libc_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
 
     err = ngx_errno;
 
-#if (NGX_THREADS && NGX_NONREENTRANT_CRYPT)
+#if (NGX_OLD_THREADS && NGX_NONREENTRANT_CRYPT)
     ngx_mutex_unlock(ngx_crypt_mutex);
 #endif
 
index 098ca24c00f89c701f85927d59c941dc6969a6d0..f4b2eea31026a5620fa00e8d7a04542aa6d6a296 100644 (file)
@@ -218,7 +218,7 @@ typedef int                 sig_atomic_t;
 #define NGX_HAVE_LITTLE_ENDIAN  1
 #define NGX_HAVE_NONALIGNED     1
 
-#define NGX_THREADS       1
+#define NGX_OLD_THREADS         1
 
 
 #define NGX_WIN_NT        200000