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



On po 6. dubna 2009, Nick Wellnhofer wrote:
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.

Yes, this wouldn't work for things like imported XSLT stylesheets
or documents loaded with the XSLT document() function.

Maybe we need to make those per-thread but this is getting ugly
!

For me personally, it would be OK if the Perl bindings had an
option to not touch the callbacks at all. We wouldn't need any
changes on the libxml side then. Only a caveat on this page would
be nice: http://xmlsoft.org/threads.html

Ok, I'll add a flag for that in the next version of XML::LibXML,

-- Petr




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