]> git.kaiwu.me - nginx.git/commitdiff
Modules compatibility: compatibility with NGX_THREADS.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 10 Oct 2016 15:44:17 +0000 (18:44 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 10 Oct 2016 15:44:17 +0000 (18:44 +0300)
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.

src/core/ngx_buf.h
src/core/ngx_connection.h
src/core/ngx_core.h
src/core/ngx_file.h
src/core/ngx_module.h
src/event/ngx_event_pipe.h
src/http/ngx_http_cache.h
src/http/ngx_http_core_module.h

index 00522cce5e6b6b8639d8355a6e5f881e9b403a87..224807cb050e0e018fca4ac132e3a89b8338c643 100644 (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;
index 1472090e5501b76cc8a7446d0f58b264db8882db..b527954e6db6e42d0e1466f6137159acc332c3c1 100644 (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
 };
index 2819c1a7d876a2785294bd170e138c60f4f6f4be..8f8489fcb5cf21809e09f2b90a0284065a283499 100644 (file)
 #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);
index 5c4482193266cdf321947b3fed241829350c5f7b..cff74cba1de0b31f7df758e3d4530140914affad 100644 (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;
index 10a7eabafbe13f1d4380aa37f9bb77629b803a36..626481d8a94d8fbe906ef8e5eea3de89453dd164 100644 (file)
 #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"
index ef2e7a0064a467f9d14f67abd4fc34708a1e4da3..10a33402774ab0bc9d785c71ba52545d0eef5c6e 100644 (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;
index 9c9ff6f6569ccc3c306dfb3647d8c6eddcf230e1..70342d0ed376ec69f7528ca335c5b53787e89337 100644 (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
 
index 628679ff3bcac472362d8d8b967d422f1e9da655..7140a6b7a674574fc901ce4ec85e6171f95eaf1a 100644 (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