comparison src/http/modules/perl/ngx_http_perl_module.c @ 3350:67da53a19e02

use global perl variable in perl_destruct()/perl_free() for non-mulitiplicity perl
author Igor Sysoev <igor@sysoev.ru>
date Tue, 17 Nov 2009 10:28:12 +0000
parents cad19e8e0cc8
children b759cf8f6000
comparison
equal deleted inserted replaced
3349:169d84ff4064 3350:67da53a19e02
150 }; 150 };
151 151
152 #endif 152 #endif
153 153
154 154
155 static ngx_str_t ngx_null_name = ngx_null_string; 155 static ngx_str_t ngx_null_name = ngx_null_string;
156 156 static HV *nginx_stash;
157 static HV *nginx_stash;
158 157
159 #if (NGX_HAVE_PERL_MULTIPLICITY) 158 #if (NGX_HAVE_PERL_MULTIPLICITY)
160 static ngx_uint_t ngx_perl_term; 159 static ngx_uint_t ngx_perl_term;
160 #else
161 static PerlInterpreter *perl;
161 #endif 162 #endif
162 163
163 164
164 static void 165 static void
165 ngx_http_perl_xs_init(pTHX) 166 ngx_http_perl_xs_init(pTHX)
459 460
460 461
461 static char * 462 static char *
462 ngx_http_perl_init_interpreter(ngx_conf_t *cf, ngx_http_perl_main_conf_t *pmcf) 463 ngx_http_perl_init_interpreter(ngx_conf_t *cf, ngx_http_perl_main_conf_t *pmcf)
463 { 464 {
464 ngx_str_t *m; 465 ngx_str_t *m;
465 ngx_uint_t i; 466 ngx_uint_t i;
466 #if (NGX_HAVE_PERL_MULTIPLICITY) 467 #if (NGX_HAVE_PERL_MULTIPLICITY)
467 ngx_pool_cleanup_t *cln; 468 ngx_pool_cleanup_t *cln;
468 469
469 cln = ngx_pool_cleanup_add(cf->pool, 0); 470 cln = ngx_pool_cleanup_add(cf->pool, 0);
470 if (cln == NULL) { 471 if (cln == NULL) {
471 return NGX_CONF_ERROR; 472 return NGX_CONF_ERROR;
472 } 473 }
473 474
474 #else
475 static PerlInterpreter *perl;
476 #endif 475 #endif
477 476
478 #ifdef NGX_PERL_MODULES 477 #ifdef NGX_PERL_MODULES
479 if (pmcf->modules == NGX_CONF_UNSET_PTR) { 478 if (pmcf->modules == NGX_CONF_UNSET_PTR) {
480 479
1065 #if (NGX_HAVE_PERL_MULTIPLICITY) 1064 #if (NGX_HAVE_PERL_MULTIPLICITY)
1066 1065
1067 ngx_perl_term = 1; 1066 ngx_perl_term = 1;
1068 1067
1069 #else 1068 #else
1070 ngx_http_perl_main_conf_t *pmcf; 1069 if (nginx_stash) {
1071
1072 pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module);
1073
1074 if (pmcf && nginx_stash) {
1075 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0, "perl term"); 1070 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0, "perl term");
1076 1071
1077 (void) perl_destruct(pmcf->perl); 1072 (void) perl_destruct(perl);
1078 1073
1079 perl_free(pmcf->perl); 1074 perl_free(perl);
1080 1075
1081 PERL_SYS_TERM(); 1076 PERL_SYS_TERM();
1082 } 1077 }
1083 1078
1084 #endif 1079 #endif