Mercurial > hg > nginx
comparison src/http/modules/perl/ngx_http_perl_module.c @ 3442:f419516d8e6e stable-0.7
merge r3351, r3352:
perl exit fixes:
*) use global perl variable in perl_destruct()/perl_free()
for non-mulitiplicity perl
*) add comment from r2716 commit message
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 01 Feb 2010 15:55:48 +0000 |
parents | 8254055b6693 |
children | 724e5cd44164 |
comparison
equal
deleted
inserted
replaced
3441:b0fbe6ab9ebe | 3442:f419516d8e6e |
---|---|
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) |
454 | 455 |
455 | 456 |
456 static char * | 457 static char * |
457 ngx_http_perl_init_interpreter(ngx_conf_t *cf, ngx_http_perl_main_conf_t *pmcf) | 458 ngx_http_perl_init_interpreter(ngx_conf_t *cf, ngx_http_perl_main_conf_t *pmcf) |
458 { | 459 { |
459 ngx_str_t *m; | 460 ngx_str_t *m; |
460 ngx_uint_t i; | 461 ngx_uint_t i; |
461 #if (NGX_HAVE_PERL_MULTIPLICITY) | 462 #if (NGX_HAVE_PERL_MULTIPLICITY) |
462 ngx_pool_cleanup_t *cln; | 463 ngx_pool_cleanup_t *cln; |
463 | 464 |
464 cln = ngx_pool_cleanup_add(cf->pool, 0); | 465 cln = ngx_pool_cleanup_add(cf->pool, 0); |
465 if (cln == NULL) { | 466 if (cln == NULL) { |
466 return NGX_CONF_ERROR; | 467 return NGX_CONF_ERROR; |
467 } | 468 } |
468 | 469 |
469 #else | |
470 static PerlInterpreter *perl; | |
471 #endif | 470 #endif |
472 | 471 |
473 #ifdef NGX_PERL_MODULES | 472 #ifdef NGX_PERL_MODULES |
474 if (pmcf->modules == NGX_CONF_UNSET_PTR) { | 473 if (pmcf->modules == NGX_CONF_UNSET_PTR) { |
475 | 474 |
1066 static void | 1065 static void |
1067 ngx_http_perl_exit(ngx_cycle_t *cycle) | 1066 ngx_http_perl_exit(ngx_cycle_t *cycle) |
1068 { | 1067 { |
1069 #if (NGX_HAVE_PERL_MULTIPLICITY) | 1068 #if (NGX_HAVE_PERL_MULTIPLICITY) |
1070 | 1069 |
1070 /* | |
1071 * the master exit hook is run before global pool cleanup, | |
1072 * therefore just set flag here | |
1073 */ | |
1074 | |
1071 ngx_perl_term = 1; | 1075 ngx_perl_term = 1; |
1072 | 1076 |
1073 #else | 1077 #else |
1074 ngx_http_perl_main_conf_t *pmcf; | 1078 |
1075 | 1079 if (nginx_stash) { |
1076 pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module); | |
1077 | |
1078 if (pmcf && nginx_stash) { | |
1079 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0, "perl term"); | 1080 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0, "perl term"); |
1080 | 1081 |
1081 (void) perl_destruct(pmcf->perl); | 1082 (void) perl_destruct(perl); |
1082 | 1083 |
1083 perl_free(pmcf->perl); | 1084 perl_free(perl); |
1084 | 1085 |
1085 PERL_SYS_TERM(); | 1086 PERL_SYS_TERM(); |
1086 } | 1087 } |
1087 | 1088 |
1088 #endif | 1089 #endif |