[Oops, I missed the APR__Pool.h section of the patch!
please disregard the previous post, this is a duplicate
with the full patch]
Joe Schaefer <[EMAIL PROTECTED]> writes:
> Perhaps using APR_OPTIONAL_FN* will do the trick here?
Proof-of-concept patch below. I don't know how to produce
a BOOT stanza in WrapXS/APR/Pool/Pool.xs, so after applying this patch
you also need to edit that file so the bottom looks like so
% tail WrapXS/APR/Pool/Pool.xs
mpxs_apr_pool_DESTROY(aTHX_ obj);
MODULE = APR::Pool
PROTOTYPES: disabled
BOOT:
items = items; /* -Wall */
mpopt_interp_unselect = APR_RETRIEVE_OPTIONAL_FN(modperl_interp_unselect);
%
Index: src/modules/perl/mod_perl.c
===================================================================
RCS file: /home/cvspublic/modperl-2.0/src/modules/perl/mod_perl.c,v
retrieving revision 1.214
diff -u -r1.214 mod_perl.c
--- src/modules/perl/mod_perl.c 2 Jun 2004 21:35:58 -0000 1.214
+++ src/modules/perl/mod_perl.c 24 Jun 2004 20:10:06 -0000
@@ -715,6 +715,8 @@
void modperl_register_hooks(apr_pool_t *p)
{
+ APR_REGISTER_OPTIONAL_FN(modperl_interp_unselect);
+
/* for <IfDefine MODPERL2> and Apache->define("MODPERL2") */
*(char **)apr_array_push(ap_server_config_defines) =
apr_pstrdup(p, "MODPERL2");
Index: src/modules/perl/mod_perl.h
===================================================================
RCS file: /home/cvspublic/modperl-2.0/src/modules/perl/mod_perl.h,v
retrieving revision 1.66
diff -u -r1.66 mod_perl.h
--- src/modules/perl/mod_perl.h 16 Jun 2004 03:55:47 -0000 1.66
+++ src/modules/perl/mod_perl.h 24 Jun 2004 20:10:06 -0000
@@ -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 */
cvs server: Diffing xs/APR
cvs server: Diffing xs/APR/APR
Index: xs/APR/APR/APR.xs
===================================================================
RCS file: /home/cvspublic/modperl-2.0/xs/APR/APR/APR.xs,v
retrieving revision 1.11
diff -u -r1.11 APR.xs
--- xs/APR/APR/APR.xs 16 Jun 2004 03:55:48 -0000 1.11
+++ xs/APR/APR/APR.xs 24 Jun 2004 20:10:06 -0000
@@ -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
===================================================================
RCS file: /home/cvspublic/modperl-2.0/xs/APR/Pool/APR__Pool.h,v
retrieving revision 1.14
diff -u -r1.14 APR__Pool.h
--- xs/APR/Pool/APR__Pool.h 14 May 2004 07:40:31 -0000 1.14
+++ xs/APR/Pool/APR__Pool.h 24 Jun 2004 20:10:07 -0000
@@ -202,6 +202,9 @@
* callback wrapper for Perl cleanup subroutines
* @param data internal storage
*/
+
+static APR_OPTIONAL_FN_TYPE(modperl_interp_unselect) *mpopt_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 && mpopt_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)mpopt_interp_unselect(cdata->interp);
}
#endif
--
Joe Schaefer
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]