Re: [xml] IO callbacks are not thread-safe



Daniel Veillard wrote:
On Thu, Apr 02, 2009 at 05:33:54PM +0200, Petr Pajas wrote:
I think the original reason for this was that when Perl bindings are used with mod_perl, there may be other (non-Perl) components using the global callbacks differently; that's why XML::LibXML Perl module tries to clean after itself (restoring whatever was in the callbacks previously). Is there any other way around this?

  Urgh ..
Why do they need global URI handler registration ?
The cleanest wey would be to always use the I/O parser context creation
routine like xmlCtxtReadIO/xmlReadIO... and define the I/O handlers
to map to whatever is being registered globally now. Though the
limitation is for external subset resources, that doesn't work well.
Maybe we need to make those per-thread but this is getting ugly !


I ran into a similar issue a while back, though dealing just with usage from within a process in a web servers rather than threads specifically. This was one of the reasons why I implemented the xmlParserInputBufferCreateFilenameDefault and xmlOutputBufferCreateFilenameDefault functions for use in PHP. That way we are able to completely isolate our I/O handling from anything else that might be running within the same process. An app could leverage those functions, though would require it to manage it its own handler lookup/setup routines.

Rob




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