randyk 2004/06/25 08:29:25
Modified: lib/ModPerl WrapXS.pm src/modules/perl mod_perl.c mod_perl.h xs/APR/APR APR.xs xs/APR/Pool APR__Pool.h Log: Submitted by: Joe Schaefer <[EMAIL PROTECTED]> Reviewed by: stas use APR_*_OPTIONAL_FN* to handle declaration of modperl_interp_unselect, so as to enable use both within and outside of mod_perl.so. Revision Changes Path 1.77 +4 -0 modperl-2.0/lib/ModPerl/WrapXS.pm Index: WrapXS.pm =================================================================== RCS file: /home/cvs/modperl-2.0/lib/ModPerl/WrapXS.pm,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- WrapXS.pm 23 Jun 2004 03:30:15 -0000 1.76 +++ WrapXS.pm 25 Jun 2004 15:29:25 -0000 1.77 @@ -548,6 +548,10 @@ } } + if ($module eq 'APR::Pool') { + print $fh " modperl_opt_interp_unselect = APR_RETRIEVE_OPTIONAL_FN(modperl_interp_unselect);\n\n"; + } + close $fh; } 1.215 +5 -0 modperl-2.0/src/modules/perl/mod_perl.c Index: mod_perl.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v retrieving revision 1.214 retrieving revision 1.215 diff -u -r1.214 -r1.215 --- mod_perl.c 2 Jun 2004 21:35:58 -0000 1.214 +++ mod_perl.c 25 Jun 2004 15:29:25 -0000 1.215 @@ -715,6 +715,11 @@ void modperl_register_hooks(apr_pool_t *p) { + +#ifdef USE_ITHREADS + APR_REGISTER_OPTIONAL_FN(modperl_interp_unselect); +#endif + /* for <IfDefine MODPERL2> and Apache->define("MODPERL2") */ *(char **)apr_array_push(ap_server_config_defines) = apr_pstrdup(p, "MODPERL2"); 1.67 +2 -0 modperl-2.0/src/modules/perl/mod_perl.h Index: mod_perl.h =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- mod_perl.h 16 Jun 2004 03:55:47 -0000 1.66 +++ mod_perl.h 25 Jun 2004 15:29:25 -0000 1.67 @@ -128,4 +128,6 @@ /* we need to hook a few internal things before APR_HOOK_REALLY_FIRST */ #define MODPERL_HOOK_REALLY_REALLY_FIRST (-20) +APR_DECLARE_OPTIONAL_FN(apr_status_t,modperl_interp_unselect,(void *)); + #endif /* MOD_PERL_H */ 1.12 +0 -6 modperl-2.0/xs/APR/APR/APR.xs Index: APR.xs =================================================================== RCS file: /home/cvs/modperl-2.0/xs/APR/APR/APR.xs,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- APR.xs 16 Jun 2004 03:55:48 -0000 1.11 +++ APR.xs 25 Jun 2004 15:29:25 -0000 1.12 @@ -15,12 +15,6 @@ #include "mod_perl.h" -/* XXX: provide the missing symbol for APR::Pool as a tmp workaround */ -#ifndef modperl_interp_unselect -apr_status_t modperl_interp_unselect(void *data); -apr_status_t modperl_interp_unselect(void *data) { return APR_SUCCESS; } -#endif - #ifdef MP_HAVE_APR_LIBS # define APR_initialize apr_initialize # define APR_terminate apr_terminate 1.15 +5 -2 modperl-2.0/xs/APR/Pool/APR__Pool.h Index: APR__Pool.h =================================================================== RCS file: /home/cvs/modperl-2.0/xs/APR/Pool/APR__Pool.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- APR__Pool.h 14 May 2004 07:40:31 -0000 1.14 +++ APR__Pool.h 25 Jun 2004 15:29:25 -0000 1.15 @@ -202,6 +202,9 @@ * callback wrapper for Perl cleanup subroutines * @param data internal storage */ + +static APR_OPTIONAL_FN_TYPE(modperl_interp_unselect) *modperl_opt_interp_unselect; + static apr_status_t mpxs_cleanup_run(void *data) { int count; @@ -233,12 +236,12 @@ } #ifdef USE_ITHREADS - if (cdata->interp) { + if (cdata->interp && modperl_opt_interp_unselect) { /* this will decrement the interp refcnt until * there are no more references, in which case * the interpreter will be putback into the mip */ - (void)modperl_interp_unselect(cdata->interp); + (void)modperl_opt_interp_unselect(cdata->interp); } #endif