summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-09-20 12:54:09 +0300
committerDennis Francis <dennis.francis@collabora.co.uk>2017-11-21 13:49:50 +0530
commitad25593f50d75976df1729d1ce2d58749827258a (patch)
treed2693348f473f248f4544180c5a9e82bf9675b70 /sc/source
parent7f8e88669c14b50327974baf3355617b8c0a7ea6 (diff)
Use explicit flag to indicate threaded formula group calculation being active
Don't just check whether we are in the "main" thread, as that is not true in the tiled rendering unit test, for instance. Change-Id: I4f3ca1a1b1cb3c92856104fffe8100f18cd7b66c
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/documen2.cxx1
-rw-r--r--sc/source/core/data/formulacell.cxx13
2 files changed, 10 insertions, 4 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index f0fc6f774930..879019ca1554 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -173,6 +173,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
nUnoObjectId( 0 ),
nRangeOverflowType( 0 ),
aCurTextWidthCalcPos(MAXCOL,0,0),
+ mbThreadedGroupCalcInProgress( false ),
nFormulaCodeInTree(0),
nXMLImportedFormulaCount( 0 ),
nInterpretLevel(0),
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 2fc8cf0280ce..a98263cc2d2a 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1744,7 +1744,6 @@ class StackCleaner
void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
{
- bool bSingleThreaded = (osl::Thread::getCurrentIdentifier() == Application::GetMainThreadIdentifier());
RecursionCounter aRecursionCounter( pDocument->GetRecursionHelper(), this);
nSeenInIteration = pDocument->GetRecursionHelper().GetIteration();
if( !pCode->GetCodeLen() && pCode->GetCodeError() == FormulaError::NONE )
@@ -2090,7 +2089,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
// a changed result must still reset the stream flag
pDocument->SetStreamValid(aPos.Tab(), false, true);
}
- if ( bSingleThreaded && !pCode->IsRecalcModeAlways() )
+ if ( !pDocument->mbThreadedGroupCalcInProgress && !pCode->IsRecalcModeAlways() )
pDocument->RemoveFromFormulaTree( this );
// FORCED cells also immediately tested for validity (start macro possibly)
@@ -2109,7 +2108,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
}
// Reschedule slows the whole thing down considerably, thus only execute on percent change
- if (bSingleThreaded)
+ if (!pDocument->mbThreadedGroupCalcInProgress)
{
ScProgress *pProgress = ScProgress::GetInterpretProgress();
if (pProgress && pProgress->Enabled())
@@ -2577,7 +2576,7 @@ void ScFormulaCell::MaybeInterpret()
{
if (NeedsInterpret())
{
- assert(osl::Thread::getCurrentIdentifier() == Application::GetMainThreadIdentifier());
+ assert(!pDocument->mbThreadedGroupCalcInProgress);
Interpret();
}
}
@@ -4396,6 +4395,9 @@ bool ScFormulaCell::InterpretFormulaGroup()
SAL_INFO("sc.threaded", "Running " << nThreadCount << " threads");
{
+ assert(!pDocument->mbThreadedGroupCalcInProgress);
+ pDocument->mbThreadedGroupCalcInProgress = true;
+
ScMutationGuard aGuard(pDocument, ScMutationGuardFlags::CORE);
// Start nThreadCount new threads
@@ -4407,6 +4409,9 @@ bool ScFormulaCell::InterpretFormulaGroup()
SAL_INFO("sc.threaded", "Joining threads");
rThreadPool.waitUntilDone(aTag);
+
+ pDocument->mbThreadedGroupCalcInProgress = false;
+
SAL_INFO("sc.threaded", "Done");
}