diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2016-10-10 18:44:17 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2016-10-10 18:44:17 +0300 |
commit | 9f6e8673f40f7532bf3059bda41e05b545520dd3 (patch) | |
tree | 6bb28049fef591146534df799590c137b5ae89db /src | |
parent | 82ec8492717dcf141eead17fd158ff3f9e072e84 (diff) | |
download | nginx-9f6e8673f40f7532bf3059bda41e05b545520dd3.tar.gz nginx-9f6e8673f40f7532bf3059bda41e05b545520dd3.zip |
Modules compatibility: compatibility with NGX_THREADS.
With this change it is now possible to load modules compiled without
the "--with-threads" configure option into nginx binary compiled with it,
and vice versa (if a module does not use thread-specific functions),
assuming both use the "--with-compat" option.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/ngx_buf.h | 4 | ||||
-rw-r--r-- | src/core/ngx_connection.h | 2 | ||||
-rw-r--r-- | src/core/ngx_core.h | 27 | ||||
-rw-r--r-- | src/core/ngx_file.h | 2 | ||||
-rw-r--r-- | src/core/ngx_module.h | 2 | ||||
-rw-r--r-- | src/event/ngx_event_pipe.h | 2 | ||||
-rw-r--r-- | src/http/ngx_http_cache.h | 2 | ||||
-rw-r--r-- | src/http/ngx_http_core_module.h | 4 |
8 files changed, 21 insertions, 24 deletions
diff --git a/src/core/ngx_buf.h b/src/core/ngx_buf.h index 00522cce5..224807cb0 100644 --- a/src/core/ngx_buf.h +++ b/src/core/ngx_buf.h @@ -88,9 +88,7 @@ struct ngx_output_chain_ctx_s { unsigned unaligned:1; unsigned need_in_memory:1; unsigned need_in_temp:1; -#if (NGX_HAVE_FILE_AIO || NGX_THREADS) unsigned aio:1; -#endif #if (NGX_HAVE_FILE_AIO) ngx_output_chain_aio_pt aio_handler; @@ -99,7 +97,7 @@ struct ngx_output_chain_ctx_s { #endif #endif -#if (NGX_THREADS) +#if (NGX_THREADS || NGX_COMPAT) ngx_int_t (*thread_handler)(ngx_thread_task_t *task, ngx_file_t *file); ngx_thread_task_t *thread_task; diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h index 1472090e5..b527954e6 100644 --- a/src/core/ngx_connection.h +++ b/src/core/ngx_connection.h @@ -186,7 +186,7 @@ struct ngx_connection_s { unsigned busy_count:2; #endif -#if (NGX_THREADS) +#if (NGX_THREADS || NGX_COMPAT) ngx_thread_task_t *sendfile_task; #endif }; diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h index 2819c1a7d..8f8489fcb 100644 --- a/src/core/ngx_core.h +++ b/src/core/ngx_core.h @@ -12,22 +12,19 @@ #include <ngx_config.h> -typedef struct ngx_module_s ngx_module_t; -typedef struct ngx_conf_s ngx_conf_t; -typedef struct ngx_cycle_s ngx_cycle_t; -typedef struct ngx_pool_s ngx_pool_t; -typedef struct ngx_chain_s ngx_chain_t; -typedef struct ngx_log_s ngx_log_t; -typedef struct ngx_open_file_s ngx_open_file_t; -typedef struct ngx_command_s ngx_command_t; -typedef struct ngx_file_s ngx_file_t; -typedef struct ngx_event_s ngx_event_t; -typedef struct ngx_event_aio_s ngx_event_aio_t; -typedef struct ngx_connection_s ngx_connection_t; - -#if (NGX_THREADS) +typedef struct ngx_module_s ngx_module_t; +typedef struct ngx_conf_s ngx_conf_t; +typedef struct ngx_cycle_s ngx_cycle_t; +typedef struct ngx_pool_s ngx_pool_t; +typedef struct ngx_chain_s ngx_chain_t; +typedef struct ngx_log_s ngx_log_t; +typedef struct ngx_open_file_s ngx_open_file_t; +typedef struct ngx_command_s ngx_command_t; +typedef struct ngx_file_s ngx_file_t; +typedef struct ngx_event_s ngx_event_t; +typedef struct ngx_event_aio_s ngx_event_aio_t; +typedef struct ngx_connection_s ngx_connection_t; typedef struct ngx_thread_task_s ngx_thread_task_t; -#endif typedef void (*ngx_event_handler_pt)(ngx_event_t *ev); typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c); diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h index 5c4482193..cff74cba1 100644 --- a/src/core/ngx_file.h +++ b/src/core/ngx_file.h @@ -23,7 +23,7 @@ struct ngx_file_s { ngx_log_t *log; -#if (NGX_THREADS) +#if (NGX_THREADS || NGX_COMPAT) ngx_int_t (*thread_handler)(ngx_thread_task_t *task, ngx_file_t *file); void *thread_ctx; diff --git a/src/core/ngx_module.h b/src/core/ngx_module.h index 10a7eabaf..626481d8a 100644 --- a/src/core/ngx_module.h +++ b/src/core/ngx_module.h @@ -127,7 +127,7 @@ #define NGX_MODULE_SIGNATURE_21 "0" #endif -#if (NGX_THREADS) +#if (NGX_THREADS || NGX_COMPAT) #define NGX_MODULE_SIGNATURE_22 "1" #else #define NGX_MODULE_SIGNATURE_22 "0" diff --git a/src/event/ngx_event_pipe.h b/src/event/ngx_event_pipe.h index ef2e7a006..10a334027 100644 --- a/src/event/ngx_event_pipe.h +++ b/src/event/ngx_event_pipe.h @@ -47,7 +47,7 @@ struct ngx_event_pipe_s { ngx_event_pipe_output_filter_pt output_filter; void *output_ctx; -#if (NGX_THREADS) +#if (NGX_THREADS || NGX_COMPAT) ngx_int_t (*thread_handler)(ngx_thread_task_t *task, ngx_file_t *file); void *thread_ctx; diff --git a/src/http/ngx_http_cache.h b/src/http/ngx_http_cache.h index 9c9ff6f65..70342d0ed 100644 --- a/src/http/ngx_http_cache.h +++ b/src/http/ngx_http_cache.h @@ -93,7 +93,7 @@ struct ngx_http_cache_s { ngx_http_file_cache_t *file_cache; ngx_http_file_cache_node_t *node; -#if (NGX_THREADS) +#if (NGX_THREADS || NGX_COMPAT) ngx_thread_task_t *thread_task; #endif diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h index 628679ff3..7140a6b7a 100644 --- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -15,6 +15,8 @@ #if (NGX_THREADS) #include <ngx_thread_pool.h> +#elif (NGX_COMPAT) +typedef struct ngx_thread_pool_s ngx_thread_pool_t; #endif @@ -409,7 +411,7 @@ struct ngx_http_core_loc_conf_s { #endif #endif -#if (NGX_THREADS) +#if (NGX_THREADS || NGX_COMPAT) ngx_thread_pool_t *thread_pool; ngx_http_complex_value_t *thread_pool_value; #endif |