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.
This commit is contained in:
Maxim Dounin 2016-10-10 18:44:17 +03:00
parent 82ec849271
commit 9f6e8673f4
8 changed files with 21 additions and 24 deletions

View File

@ -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;

View File

@ -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
};

View File

@ -24,10 +24,7 @@ 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_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);

View File

@ -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;

View File

@ -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"

View File

@ -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;

View File

@ -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

View File

@ -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