It's mostly dead code and the original idea of worker threads has been rejected.
0,
NULL },
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
{ ngx_string("worker_threads"),
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
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
#endif
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
ngx_conf_init_value(ccf->worker_threads, 0);
ngx_threads_n = ccf->worker_threads;
}
}
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
/*
* we have to clean the connection information before the closing
unsigned busy_count:2;
#endif
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
ngx_atomic_t lock;
#endif
};
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
ngx_array_t env;
char **environment;
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
ngx_int_t worker_threads;
size_t thread_stack_size;
#endif
} 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)
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
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) {
static ngx_inline void
ngx_regex_malloc_done(void)
{
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
ngx_core_tls_t *tls;
if (ngx_threaded) {
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) {
#else
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
#error ngx_spinlock() or ngx_atomic_cmp_set() are not defined !
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
return NGX_ERROR;
}
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
list_mutex = ngx_mutex_init(cycle->log, 0);
if (list_mutex == NULL) {
ngx_kqueue = -1;
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
ngx_mutex_destroy(kevent_mutex);
ngx_mutex_destroy(list_mutex);
#endif
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");
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");
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;
next = &c[i];
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
c[i].lock = 0;
#endif
} while (i);
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;
ngx_event_save_peer_session_pt save_session;
#endif
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
ngx_atomic_t *lock;
#endif
m->last = ev;
ev->next = NULL;
-#if (NGX_THREADS0)
+#if (NGX_OLD_THREADS0)
ev->light = 1;
#endif
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
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
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
ngx_setproctitle("worker process");
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
{
ngx_int_t n;
ngx_err_t err;
ngx_uint_t i;
ngx_connection_t *c;
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
ngx_terminate = 1;
ngx_wakeup_worker_threads(cycle);
}
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
static void
ngx_wakeup_worker_threads(ngx_cycle_t *cycle)
#include <ngx_config.h>
#include <ngx_core.h>
-#if (NGX_THREADS)
+#if (NGX_OLD_THREADS)
#define NGX_MAX_THREADS 128
ngx_int_t ngx_cond_signal(ngx_cond_t *cv);
-#else /* !NGX_THREADS */
+#else /* !NGX_OLD_THREADS */
#define ngx_thread_volatile
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 */
*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;
err = ngx_errno;
-#if (NGX_THREADS && NGX_NONREENTRANT_CRYPT)
+#if (NGX_OLD_THREADS && NGX_NONREENTRANT_CRYPT)
ngx_mutex_unlock(ngx_crypt_mutex);
#endif
#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