Re: [xml] libxml2 thread safety

On Tue, 2 Oct 2001, Daniel Veillard wrote:

  There is actually 2 kinds of global variables:
    - real ones like the XML predefined entities table, which are truely
      global and should stay read only
    - preference global variables which are currently used to avoid entry
      points like xmlParseFile to have 20 arguments.

I have handled the second class of data in the past by having an opaque
environmental structure that I modify functionally and then pass into
all routines.  I subscribe to the C/OO heresy (double heresy, really,
against C and OO 8^) and so I can often just roll this structure into
my object universe.

Personally, I would prefer to see such an arrangement in libxml as opposed
to the status quo of a bunch of global variables for the general reason
of multiprogramming in addition to the narrow case of thread safety.
I've got an optionally multithreaded program that will be making
widespread use of xml in several different subsystems, but even without
threading, keeping straight what state all of these components (config
file reader, rule file reader, XSL report transformer, report outputter,
HTTP-content-xml-parser) want libxml to be in is going to be a complete
pain in the ass.  If I had an environment structure that controlled the
behavior instead of all of these globals, I would be much happier.

But I'll deal with whatever the pros writing the code come up with,
and it's still all a lot better than writing my own damned parsers; $0.02.

Todd Lewis
tlewis mindspring com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]