[Libreoffice-commits] core.git: sc/source
Tor Lillqvist
tml at collabora.com
Wed Sep 27 14:44:44 UTC 2017
sc/source/core/inc/interpre.hxx | 4 ++--
sc/source/core/tool/interpr1.cxx | 4 ++--
sc/source/core/tool/interpr4.cxx | 8 ++++----
3 files changed, 8 insertions(+), 8 deletions(-)
New commits:
commit ff51bd725da01b9ad4fef268b08b6a5b22516d81
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Aug 16 12:25:17 2017 +0300
Make pGlobalStack and bGlobalStackInUse thread_local
Change-Id: Ie196510f68d7bd0a129b92886dbff8af35c81fe8
Reviewed-on: https://gerrit.libreoffice.org/41659
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 401a920d8afe..299104fbb8e8 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -191,8 +191,8 @@ private:
static ScCalcConfig& GetOrCreateGlobalConfig();
static ScCalcConfig *mpGlobalConfig;
- static ScTokenStack* pGlobalStack;
- static bool bGlobalStackInUse;
+ static thread_local std::unique_ptr<ScTokenStack> pGlobalStack;
+ static thread_local bool bGlobalStackInUse;
ScCalcConfig maCalcConfig;
formula::FormulaTokenIterator aCode;
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index e6d9d8a8b7ca..a637c98c390e 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -77,8 +77,8 @@ IMPL_FIXEDMEMPOOL_NEWDEL( ScTokenStack )
IMPL_FIXEDMEMPOOL_NEWDEL( ScInterpreter )
ScCalcConfig *ScInterpreter::mpGlobalConfig = nullptr;
-ScTokenStack* ScInterpreter::pGlobalStack = nullptr;
-bool ScInterpreter::bGlobalStackInUse = false;
+thread_local std::unique_ptr<ScTokenStack> ScInterpreter::pGlobalStack;
+thread_local bool ScInterpreter::bGlobalStackInUse = false;
using namespace formula;
using ::std::unique_ptr;
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 0f48a2696f0c..f490a56a513e 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3823,8 +3823,8 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
{
bGlobalStackInUse = true;
if (!pGlobalStack)
- pGlobalStack = new ScTokenStack;
- pStackObj = pGlobalStack;
+ pGlobalStack.reset(new ScTokenStack);
+ pStackObj = pGlobalStack.get();
}
else
{
@@ -3835,7 +3835,7 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
ScInterpreter::~ScInterpreter()
{
- if ( pStackObj == pGlobalStack )
+ if ( pStackObj == pGlobalStack.get() )
bGlobalStackInUse = false;
else
delete pStackObj;
@@ -3868,7 +3868,7 @@ void ScInterpreter::MergeCalcConfig()
void ScInterpreter::GlobalExit()
{
OSL_ENSURE(!bGlobalStackInUse, "who is still using the TokenStack?");
- DELETEZ(pGlobalStack);
+ pGlobalStack.reset();
}
namespace {
More information about the Libreoffice-commits
mailing list