On Mon, 15 Sep 2003, Stas Bekman wrote:

> Nick Ing-Simmons wrote:
> [...]
>
> > The maelstrom of waters surounding Win32's various
> > mallocs when threaded are dangerous.
>
> I think it's no longer an issue, we just don't use perl's
> malloc here, but apr's apr_palloc, which has no such
> problems. Once Steve, Randy or someone else on win32
> confirms that my patch solves the problem for them, i'll
> commit it.

It works for me - just to summarize, and to include Steve's
patch for the fprintf problem, here's what I used:
=========================================================
Index: src/modules/perl/mod_perl.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
retrieving revision 1.183
diff -u -r1.183 mod_perl.c
--- src/modules/perl/mod_perl.c 11 Sep 2003 18:10:39 -0000      1.183
+++ src/modules/perl/mod_perl.c 16 Sep 2003 03:23:00 -0000
@@ -22,7 +22,7 @@
 #endif

 /* see modperl_hash_seed_set() */
-static void modperl_hash_seed_init(apr_pool_t *p)
+static void modperl_hash_seed_init(pTHX_ apr_pool_t *p)
 {
 #ifdef MP_NEED_HASH_SEED_FIXUP
     char *s;
@@ -41,7 +41,7 @@

     /* calculate our own random hash seed */
     if (!MP_init_hash_seed_set) {
-        apr_uuid_t *uuid = (apr_uuid_t *)safemalloc(sizeof(apr_uuid_t));
+        apr_uuid_t *uuid = (apr_uuid_t *)apr_palloc(p, sizeof(apr_uuid_t));
         char buf[APR_UUID_FORMATTED_LENGTH + 1];
         int i;

@@ -63,8 +63,8 @@
         if (s) {
             int i = atoi(s);
             if (i == 1) {
-                fprintf(stderr, "\nmod_perl: using init hash seed: %"UVuf"\n",
-                        MP_init_hash_seed);
+                PerlIO_printf(Perl_error_log, "\nmod_perl: using init hash seed: 
%"UVuf"\n",
+                              MP_init_hash_seed);
             }
         }
     }
@@ -587,10 +587,12 @@
 int modperl_hook_pre_config(apr_pool_t *p, apr_pool_t *plog,
                             apr_pool_t *ptemp)
 {
+    dTHX;
+
     /* we can't have PerlPreConfigHandler without first configuring mod_perl */

     /* perl 5.8.1+ */
-    modperl_hash_seed_init(p);
+    modperl_hash_seed_init(aTHX_ p);

     return OK;
 }
========================================================================

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to