[xml] [Q] libxml-2.2.2.3 Thread Safe ?

Date view Thread view Subject view Author view

From: Marc Sanfacon (sanm@copernic.com)
Date: Wed Sep 27 2000 - 14:17:32 EDT


Hi there,
        I am using libxml-2.2.2.3 under Windows 2000, with VC 6.0. I have
written a small test that creates 5 threads and calls the following
functions of libxml:

        - htmlCreateFileParserCtxt
        - htmlParseDocument
          - htmlFreeParserCtxt
          - MyPrintFunction: Print out the result in a file.

Before creating the threads, I execute the test in a single-threaded
environment to get the output file that will be used to compare the results
of the threaded parsing.

I have tried to put a mutex (that locks the parser, so it can parser only
one file at a time) in all possible places, here are the results:

1- Works fine
        {Mutex - htmlCreateFileParserCtxt
                        - htmlParseDocument
                          - htmlFreeParserCtxt
                      - MyPrintFunction: Print out the result in a file.
          }

2- Works fine
        {Mutex - htmlCreateFileParserCtxt
                        - htmlParseDocument
                          - htmlFreeParserCtxt
          }
        - MyPrintFunction: Print out the result in a file.

3- Works fine
        {Mutex - htmlCreateFileParserCtxt
                        - htmlParseDocument
          }
        - htmlFreeParserCtxt
        - MyPrintFunction: Print out the result in a file.

4- Works fine
          - htmlCreateFileParserCtxt
        {Mutex - htmlParseDocument
          }
        - htmlFreeParserCtxt
        - MyPrintFunction: Print out the result in a file.

5- Does not work
          NO MUTEX
          - htmlCreateFileParserCtxt
        - htmlParseDocument
        - htmlFreeParserCtxt
        - MyPrintFunction: Print out the result in a file.

Since 'htmlParseDocument' and 'xmlParseDocument' are the functions that does
the main job, anybody that can point me out where the problem might come
from ?

I have begun to trace the code, but there are lots of code, so any pointer
would be really appreciated.

Regards,
        Marc.

---------------------------------------------------------------------
 "Better the pride that resides, in a citizen of the world.
  Than the pride that divides, when a colorful rag is
  unfurled." Neil Peart
---------------------------------------------------------------------
Marc Sanfacon, Software developer Copernic.com
e-mail: sanm@copernic.com R&D Group
Tel : (418) 527-0528 ext 1212

Get COPERNIC SHOPPER for FREE at:
Procurez-vous GRATUITEMENT COPERNIC SHOPPER a :
<http://www.copernic.com/products/shopper/download.html>

----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Sep 27 2000 - 14:43:34 EDT