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



Petr Pajas schrieb:
On Monday 06 April 2009 18:36:25 Michael Ludwig wrote:

If someone has time to explain this to the uninitiated: What are
these input and output callbacks of libxml? Or are they not part of
the Perl interface, just part of the C interface?

Hallo Michael,

This is a feature of libxml2, avalable in Perl bindings via the
XML::LibXML::InputCallback module. The callbacks allow you to bypass
the "normal" way libxml2 retrieves data from URLs. You can register
callbacks that recognize which URL you want to handle differently and
feed any content to the parser. You can use it to do things like URL
rewriting or using special URL schemes to pull data from a database or
other application specific resource.

Thanks Petr and Nick (off-list) for your replies. I feel less ignorant
now.

The scenario discussed here is Apache web server using threads instead
of forks to serve content to concurrent clients.

And can you control the number of processors to be engaged by Perl?

Well, these are not Perl threads (i.e threads within one Perl
interpreter) we are talking about, these are multiple thread each of
which can run its own Perl/PHP or whatever interpreter.

So multi-threadedness for libxml2 (loaded once in memory), but not for
Perl, which is started several times? Is that about accurate?

Perl threads are a different and ugly beast: do not use them unless
you want your application to get much much slower, which you don't.

These are Perl interpreter threads, or ithreads, I guess. Haven't been
able to find much documentation about them, which suggests they're not
in use, which suggests it's not worth while using them.

Please use perl-xml listserv activestate com for discussion specific
to Perl- bindings.

I'll do that. Thanks again!

Michael Ludwig



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