Hi all,
A "xmlRMutexPtr mutex" was introduced in "struct _xmlDict" by SVN revision#2947
(svn diff -c 2947 http://svn.gnome.org/svn/libxml2/trunk/dict.c).
A global "static xmlRMutexPtr xmlDictMutex" was prefered to this by-dict mutex
in revision#2948
(svn diff -c 2948 http://svn.gnome.org/svn/libxml2/trunk/dict.c).
But the original by-dict mutex is still present in "struct _xmlDict" and is no
more used.
(svn cat -r HEAD http://svn.gnome.org/svn/libxml2/trunk/dict.c)
I've attached a patch that remove this unused mutex.
Florent,
PS: Here is the different commit logs:
r2947 | veillard | 2005-01-21 17:55:41 +0100 (ven, 21 jan 2005) | 4 lines
* dict.c: patch from Gary Coady to fix a race in dict reference
counting in multithreaded apps.
Daniel
r2948 | veillard | 2005-01-22 00:53:26 +0100 (sam, 22 jan 2005) | 5 lines
* dict.c parser.c include/libxml/dict.h: a single lock version
mostly avoid the cost penalty of the lock in case of low
parallelism, so applying that version instead.
Daniel
and here is the last message of the original mailinglist's thread:
http://mail.gnome.org/archives/xml/2005-January/msg00160.html
Index: dict.c
===================================================================
--- dict.c (revision 3678)
+++ dict.c (working copy)
@@ -60,7 +60,6 @@
*/
struct _xmlDict {
int ref_counter;
- xmlRMutexPtr mutex;
struct _xmlDictEntry *dict;
int size;
@@ -337,11 +336,8 @@
dict->strings = NULL;
dict->subdict = NULL;
if (dict->dict) {
- if ((dict->mutex = xmlNewRMutex()) != NULL) {
- memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry));
- return(dict);
- }
- xmlFree(dict->dict);
+ memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry));
+ return(dict);
}
xmlFree(dict);
}
@@ -545,7 +541,6 @@
xmlFree(pool);
pool = nextp;
}
- xmlFreeRMutex(dict->mutex);
xmlFree(dict);
}
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml