Re: [xslt] threaded use with xsltCleanupGlobals()



On Tue, Oct 07, 2008 at 04:57:09PM +0100, Sam Liddicott wrote:
> I think that a multi-threaded user of libxslt should generally only call
> xsltCleanupGlobals() when the application is about to shut down;

  yes

> What nasty thing might happen if a thread calls xsltCleanupGlobals() and
> maybe while another thread is doing xslt processing?
> 
> (And the same for xmlCleanupParser I guess).

  even worse, wor example predefined entities would suddenly disapear,
near garanteed crash for the other threads,

> I guess it is ok to call xsltFreeStylesheet and xmlFreeDoc from a thread
> as a thread-private reference is passed.

  You can actually share stylesheets between threads (once compiled),
but you need to handle the synchronization for freeing. Don't assume
a doc is necessarily thread-private even if in most case that should be
true (well it depends on your model if you don't share compiled
stylesheets everything should be kept private).

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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