Re: [xml] side effects of thread-enabling libxml2

On Sun, May 04, 2003 at 12:22:51PM +0200, Stéphane Bidoul wrote:
I'm fearing side effect with libxml2 now defaulting to with-threads=yes.
The problem lies with per-thread globals, and the per-thread generic error
handler in particular.

  Hum, right, there are some side effects for those who where using
libxml2 with threads without configuring them ...

Now, if my sysadmin deploys libxml2 2.5.7 (with-threads=yes),
the behaviour of my programs will suddenly change, because
the python bindings set a single generic error handler wrapper
at initialization time, and not for each thread that is created.

  Right, in C that could be avoided by setting the global variables
without calling the libxml init function I think, but from Python
or other language binding where initializing the bindings initialize
the library that cannot be handled as-is.

I have several questions:
0. Do other applications risk the same problem?

  Yes basically those using threads especially if they don't have the
control of the initialization.

1. should I  attempt to change the python bindings so the globals in
there are also created per-threads (not a pleasant perspective).

  I think that the per thread property of the global variables is a
feature, that functionality should be preserved. What it means is
that the current API now lack the possibility to setup the global
default values. I think going back is not the way to go, going forward
is. Basically what you're asking for is the possibility to set up
the global variable default used to initialize the values inherited
from new threads, and that would be sufficient, right ? I doubt you
actually want to change the global variable dynamically in the 
various threads running at a given point in time.
  Seems to me that making the affectation in the "main thread" is one
way to do this. The other option is to generate xmlSetGlobalXXX()
funtions, which should be realtively easy to do within globals.c


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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