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



On Fri, May 09, 2003 at 06:06:04PM +0200, Stéphane Bidoul wrote:
I think I suggested adding functions
to register the global default values and the other things
needed would be
to take a lock when initializing a thread set of local variables.

Ah, it's that one... Bon, let's see if I got it, this time.
Something like this, generated from global.data?

/* the new variable */
static xmlGenericErrorFunc xmlGlobalGenericError =
xmlGenericErrorDefaultFunc;

/* SetGlobal */
void xmlSetGlobalGenericError(xmlGenericErrorFunc v)
{
  ACQUIRE_LOCK
  xmlGlobalGenericError = v;
  RELEASE_LOCK
}

/* GetGlobal */
xmlGenericErrorFunc xmlGetGlobalGenericError()
{
  xmlGenericErrorFunc ret;
  ACQUIRE_LOCK
  ret = xmlGlobalGenericError ;
  RELEASE_LOCK
  return ret;
}

  yup something like that. Be careful, global.data may just be outdated ...

And:
- xmlInitializeGlobalState adapted to initialize from
xmlGlobal values and to acquire/release the lock
- All SetGlobal/GetGlobal added in libxml2-api.xml

  Sounds right

I'm not sure what to do with the following calls in
xmlInitializeGlobalState: initGenericErrorDefaultFunc,
inithtmlDefaultSAXHandler, initdocbDefaultSAXHandler,
initxmlDefaultSAXHandler?

  I would keep them as-is I think, they will still read from the
global SAX data area. Not 100% sure though, this might require some
testing...

And the globals for the main thread will *not* be initialized
from the new xmlGlobal values, right?

  Why not ?

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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