Re: [xml] Useless mutex in struct _xmlDict



On Fri, Feb 08, 2008 at 04:11:25PM +0100, Florent Guiliani wrote:
Daniel Veillard a écrit :
On Thu, Jan 24, 2008 at 04:08:47PM +0100, Florent Guiliani wrote:
I've attached a patch that remove this unused mutex.
May I omited to say that the attached patch can be applied directly on trunk? or 
do I missed something else in the "sending patch guidelines"?

 No it's just that I was on the road at that time. Patch is fine,
so I applied it and commited to SVN, thanks !

 BTW how did you spot this, I doubt this can show up in runtime profiling
so I'm wondering ...


I was looking into the sources and the mailing list to check if xmlDict was
thread safe.
I was wondering how a same xmlDict could be shared bitween multiple xmlDoc.
I found that like xmlDoc, xmlDict must be protected if used in multiple thread.
I am right?

  Right, but ...

you can use 
  xmlDictPtr xmlDictCreateSub(xmlDictPtr sub)

where strings will be added only on the new dictionnary but
old common strings can come from the read-only sub. This allow
to share entries between parallel processes each process then
grow its own dict on top of the main one. I use that in libxslt
for example.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]