Access to ProcessEventsToSignal's bSignal is racy

...so spell out its single use, locking the appropriate mutex around the access

Change-Id: I8e8f47de1979f5a80cf1ad65e5ec24d25145c463
Reviewed-on: https://gerrit.libreoffice.org/42908
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2017-09-28 13:59:13 +02:00
parent 736a4e659c
commit 0d43f5176d
4 changed files with 9 additions and 13 deletions

View File

@@ -181,8 +181,6 @@ bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl)
|| name == "convert_slashes" || name == "convert_slashes"
// UNO component entry points // UNO component entry points
|| name.endswith("component_getFactory") || name.endswith("component_getFactory")
// in Scheduler::, wants to loop until a reference to a bool becomes true
|| name == "ProcessEventsToSignal"
// external API // external API
|| name == "Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_flush" || name == "Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_flush"
|| name == "egiGraphicExport" || name == "egiGraphicExport"

View File

@@ -64,11 +64,6 @@ public:
* @see Application::Reschedule * @see Application::Reschedule
*/ */
static void ProcessEventsToIdle(); static void ProcessEventsToIdle();
/**
* Process events until the parameter turns true,
* allows processing until a specific event has been processed
*/
static void ProcessEventsToSignal(bool& bSignal);
/// Control the deterministic mode. In this mode, two subsequent runs of /// Control the deterministic mode. In this mode, two subsequent runs of
/// LibreOffice fire about the same amount idles. /// LibreOffice fire about the same amount idles.

View File

@@ -486,11 +486,6 @@ bool Application::Reschedule( bool i_bAllEvents )
return ImplYield(false, i_bAllEvents); return ImplYield(false, i_bAllEvents);
} }
void Scheduler::ProcessEventsToSignal(bool& bSignal)
{
while (!bSignal && Application::Reschedule() );
}
void Scheduler::ProcessEventsToIdle() void Scheduler::ProcessEventsToIdle()
{ {
int nSanity = 1; int nSanity = 1;

View File

@@ -96,7 +96,15 @@ IMPL_LINK_NOARG(ExecuteWrapper, ExecuteActionHdl, Timer*, void)
aIdle.Start(); aIdle.Start();
} }
Scheduler::ProcessEventsToSignal(mbSignal); for (;;) {
{
std::unique_lock<std::mutex> lock(mMutex);
if (mbSignal) {
break;
}
}
Application::Reschedule();
}
std::unique_lock<std::mutex> lock(mMutex); std::unique_lock<std::mutex> lock(mMutex);
while (!mbSignal) while (!mbSignal)
{ {