[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/master] Make static variables used in DocBook output thread-safe.
From:       Richard Heck <rgheck () lyx ! org>
Date:       2014-10-26 17:02:03
Message-ID: 20141026170203.5975828072E () lyx ! lyx ! org
[Download RAW message or body]

commit 452a7a500c78aeb04f5a2695a368cfdc1efd4c0d
Author: Richard Heck <rgheck@lyx.org>
Date:   Sun Oct 26 12:53:41 2014 -0400

    Make static variables used in DocBook output thread-safe.

diff --git a/src/sgml.cpp b/src/sgml.cpp
index fdd0ed7..125ef61 100644
--- a/src/sgml.cpp
+++ b/src/sgml.cpp
@@ -26,6 +26,7 @@
 #include "support/docstream.h"
 #include "support/lstrings.h"
 #include "support/textutils.h"
+#include "support/ThreadStorage.h"
 
 #include <map>
 
@@ -135,10 +136,11 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams,
 
 	docstring content;
 
-	// FIXME THREAD
 	typedef map<docstring, docstring> MangledMap;
-	static MangledMap mangledNames;
-	static int mangleID = 1;
+	static ThreadStorage<MangledMap> tMangledNames;
+	MangledMap & mangledNames = *tMangledNames;
+	static ThreadStorage<int> tMangleID;
+	int & mangleID = *tMangleID;
 
 	MangledMap::const_iterator const known = mangledNames.find(orig);
 	if (known != mangledNames.end())

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic