dougm 2002/06/20 17:44:24 Modified: src/modules/perl mod_perl.c modperl_interp.c modperl_util.c modperl_util.h Log: use our own modperl_sys_dlclose instead of apr_dso_unload which requires us to create our own pool. Revision Changes Path 1.127 +3 -5 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.126 retrieving revision 1.127 diff -u -r1.126 -r1.127 --- mod_perl.c 16 Jun 2002 01:07:37 -0000 1.126 +++ mod_perl.c 21 Jun 2002 00:44:24 -0000 1.127 @@ -5,18 +5,16 @@ { modperl_cleanup_data_t *cdata = (modperl_cleanup_data_t *)data; PerlInterpreter *perl = (PerlInterpreter *)cdata->data; - apr_array_header_t *handles; + void **handles; - handles = modperl_xs_dl_handles_get(aTHX_ cdata->pool); + handles = modperl_xs_dl_handles_get(aTHX); MP_TRACE_i(MP_FUNC, "destroying interpreter=0x%lx\n", (unsigned long)perl); modperl_perl_destruct(perl); - if (handles) { - modperl_xs_dl_handles_close(cdata->pool, handles); - } + modperl_xs_dl_handles_close(handles); modperl_env_unload(); 1.47 +3 -14 modperl-2.0/src/modules/perl/modperl_interp.c Index: modperl_interp.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- modperl_interp.c 17 Jun 2002 20:00:44 -0000 1.46 +++ modperl_interp.c 21 Jun 2002 00:44:24 -0000 1.47 @@ -80,8 +80,7 @@ void modperl_interp_destroy(modperl_interp_t *interp) { - apr_pool_t *p = NULL; - apr_array_header_t *handles; + void **handles; dTHXa(interp->perl); PERL_SET_CONTEXT(interp->perl); @@ -93,21 +92,11 @@ MP_TRACE_i(MP_FUNC, "*error - still in use!*\n"); } - /* we cant use interp->mip->ap_pool without locking - * apr_pool_create() will mutex lock for us - * XXX: could roll something without using apr_pool_t - * to avoid locking - */ - (void)apr_pool_create(&p, NULL); - handles = modperl_xs_dl_handles_get(aTHX_ p); + handles = modperl_xs_dl_handles_get(aTHX); modperl_perl_destruct(interp->perl); - if (handles) { - modperl_xs_dl_handles_close(p, handles); - } - - apr_pool_destroy(p); + modperl_xs_dl_handles_close(handles); } apr_status_t modperl_interp_cleanup(void *data) 1.47 +12 -13 modperl-2.0/src/modules/perl/modperl_util.c Index: modperl_util.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- modperl_util.c 19 Jun 2002 05:18:04 -0000 1.46 +++ modperl_util.c 21 Jun 2002 00:44:24 -0000 1.47 @@ -300,12 +300,12 @@ } } -apr_array_header_t *modperl_xs_dl_handles_get(pTHX_ apr_pool_t *p) +void **modperl_xs_dl_handles_get(pTHX) { I32 i; AV *librefs = get_av(dl_librefs, FALSE); AV *modules = get_av(dl_modules, FALSE); - apr_array_header_t *handles; + void **handles; if (!librefs) { MP_TRACE_g(MP_FUNC, @@ -319,7 +319,7 @@ return NULL; } - handles = apr_array_make(p, AvFILL(librefs)-1, sizeof(void *)); + handles = (void **)malloc(sizeof(void *) * (AvFILL(librefs)+2)); for (i=0; i<=AvFILL(librefs); i++) { void *handle; @@ -337,17 +337,19 @@ MP_TRACE_g(MP_FUNC, "%s dl handle == 0x%lx\n", SvPVX(module_sv), (unsigned long)handle); if (handle) { - *(void **)apr_array_push(handles) = handle; + handles[i] = handle; } } av_clear(modules); av_clear(librefs); + handles[i] = (void *)0; + return handles; } -void modperl_xs_dl_handles_close(apr_pool_t *p, apr_array_header_t *handles) +void modperl_xs_dl_handles_close(void **handles) { int i; @@ -355,15 +357,12 @@ return; } - for (i=0; i < handles->nelts; i++) { - apr_dso_handle_t *dso = NULL; - void *handle = ((void **)handles->elts)[i]; - - MP_TRACE_g(MP_FUNC, "close 0x%lx\n", (unsigned long)handle); - - apr_os_dso_handle_put(&dso, (apr_os_dso_handle_t )handle, p); - apr_dso_unload(dso); + for (i=0; handles[i]; i++) { + MP_TRACE_g(MP_FUNC, "close 0x%lx\n", (unsigned long)handles[i]); + modperl_sys_dlclose(handles[i]); } + + free(handles); } modperl_cleanup_data_t *modperl_cleanup_data_new(apr_pool_t *p, void *data) 1.35 +2 -2 modperl-2.0/src/modules/perl/modperl_util.h Index: modperl_util.h =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- modperl_util.h 19 Jun 2002 05:18:04 -0000 1.34 +++ modperl_util.h 21 Jun 2002 00:44:24 -0000 1.35 @@ -75,9 +75,9 @@ void modperl_xs_dl_handles_clear(pTHX); -apr_array_header_t *modperl_xs_dl_handles_get(pTHX_ apr_pool_t *p); +void **modperl_xs_dl_handles_get(pTHX); -void modperl_xs_dl_handles_close(apr_pool_t *p, apr_array_header_t *handles); +void modperl_xs_dl_handles_close(void **handles); modperl_cleanup_data_t *modperl_cleanup_data_new(apr_pool_t *p, void *data);