On Fri, 21 Jun 2002 18:03:23 PDT, Doug MacEachern wrote:
>i posted patches to make XML::Parser and Image::Magick threadsafe, but 
>neither has shown up the lists.  if anybody knows how to get them through 
>to the right people, i've put them here: 
>http://perl.apache.org/~dougm/ithread-xs-patches/
>
>and started a list of known modules that need patching there too.
>
>not using any of these myself, but am working with a customer who is 
>considering migrating to 5.8.0/apache-2.0/modperl-2.0
>
>seems like a good time to start combing other cpan modules for thread 
>issues before 5.8.0 is released.

FWIW, I'm using the attached (more idiomatic) patch for XML-Parser.
Patch is against an older XML-Parser (v2.27) IIRC, so it may or
may not apply against the latest from CPAN.


Sarathy
[EMAIL PROTECTED]
-----------------------------------8<-----------------------------------
Index: XML-Parser/Expat/Expat.xs
--- XML-Parser/Expat/Expat.xs.~1~       Fri Jun 21 18:09:31 2002
+++ XML-Parser/Expat/Expat.xs   Fri Jun 21 18:09:31 2002
@@ -247,9 +247,15 @@
   SV* endcd_sv;
 } CallbackVector;
 
+#define MY_CXT_KEY "XML::Parser::_guts" XS_VERSION
+
+typedef struct {
+    HV *       x_EncodingTable;        /* cache for encodings */
+} my_cxt_t;
 
-static HV* EncodingTable = NULL;
+START_MY_CXT
 
+#define EncodingTable          (MY_CXT.x_EncodingTable)
 
 /* Forward declarations */
 static void check_and_set_default_handler(XML_Parser parser,
@@ -1684,6 +1690,7 @@
 static int
 unknownEncoding(void *unused, const char *name, XML_Encoding *info)
 {
+  dMY_CXT;
   SV ** encinfptr;
   Encinfo *enc;
   int namelen;
@@ -1883,6 +1890,12 @@
 
 MODULE = XML::Parser::Expat PACKAGE = XML::Parser::Expat       PREFIX = XML_
 
+BOOT:
+{
+    MY_CXT_INIT;
+    EncodingTable = Nullhv;
+}
+
 XML_Parser
 XML_ParserCreate(self_sv, enc_sv, namespaces)
         SV *                    self_sv
@@ -2567,6 +2580,7 @@
              RETVAL = &PL_sv_undef;
            }
            else {
+             dMY_CXT;
              /* Convert to uppercase and get name length */
 
              for (i = 0; i < sizeof(emh->name); i++) {
End of Patch.

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

Reply via email to