Kaydet (Commit) 12fc1d53 authored tarafından Fakabbir Amin's avatar Fakabbir Amin Kaydeden (comit) Noel Grandin

tdf#84323: Make osl::Condition::wait more readable

Improved readability of calls to osl::Condition::wait.

Change-Id: I69fb9815561013f1eb9fd4a649e32902e09473c6
Reviewed-on: https://gerrit.libreoffice.org/34399Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b8d8fb3f
......@@ -21,6 +21,7 @@
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cstddef>
#include <list>
#include <set>
......@@ -178,8 +179,7 @@ Components::WriteThread::WriteThread(
}
void Components::WriteThread::execute() {
TimeValue t = { 1, 0 }; // 1 sec
delay_.wait(&t); // must not throw; result_error is harmless and ignored
delay_.wait(std::chrono::seconds(1)); // must not throw; result_error is harmless and ignored
osl::MutexGuard g(*lock_); // must not throw
try {
try {
......
......@@ -32,6 +32,7 @@
#include <sfx2/lokhelper.hxx>
#include <svx/svdpage.hxx>
#include <chrono>
#include <tabvwsh.hxx>
#include <docsh.hxx>
#include <document.hxx>
......@@ -352,15 +353,13 @@ void ScTiledRenderingTest::testDocumentSize()
// Set cursor column
pViewShell->SetCursor(100, 0);
// 2 seconds
TimeValue aTime = { 2 , 0 };
osl::Condition::Result aResult = m_aDocSizeCondition.wait(aTime);
osl::Condition::Result aResult = m_aDocSizeCondition.wait(std::chrono::seconds(2));
CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
// Set cursor row
pViewShell->SetCursor(0, 100);
// 2 seconds
aTime = { 2 , 0 };
aResult = m_aDocSizeCondition.wait(aTime);
aResult = m_aDocSizeCondition.wait(std::chrono::seconds(2));
CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
comphelper::LibreOfficeKit::setActive(false);
......
......@@ -45,6 +45,8 @@
#include <sfx2/request.hxx>
#include <svx/svxids.hrc>
#include <chrono>
using namespace css;
static const char* const DATA_DIRECTORY = "/sd/qa/unit/tiledrendering/data/";
......@@ -668,8 +670,7 @@ void SdTiledRenderingTest::testInsertDeletePage()
for (unsigned it = 1; it <= 10; it++)
comphelper::dispatchCommand(".uno:InsertPage", aArgs);
TimeValue aTimeValue = { 2 , 0 }; // 2 seconds max
osl::Condition::Result aResult = m_aDocumentSizeCondition.wait(aTimeValue);
osl::Condition::Result aResult = m_aDocumentSizeCondition.wait(std::chrono::seconds(2));
CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
// Verify inserted slides
......@@ -686,7 +687,7 @@ void SdTiledRenderingTest::testInsertDeletePage()
for (unsigned it = 1; it <= 10; it++)
comphelper::dispatchCommand(".uno:DeletePage", aArgs);
aResult = m_aDocumentSizeCondition.wait(aTimeValue);
aResult = m_aDocumentSizeCondition.wait(std::chrono::seconds(2));
CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
// Verify deleted slides
......@@ -702,7 +703,7 @@ void SdTiledRenderingTest::testInsertDeletePage()
for (unsigned it = 1; it <= 10; it++)
comphelper::dispatchCommand(".uno:Undo", aArgs);
aResult = m_aDocumentSizeCondition.wait(aTimeValue);
aResult = m_aDocumentSizeCondition.wait(std::chrono::seconds(2));
CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
// Verify inserted slides
......@@ -718,7 +719,7 @@ void SdTiledRenderingTest::testInsertDeletePage()
for (unsigned it = 1; it <= 10; it++)
comphelper::dispatchCommand(".uno:Redo", aArgs);
aResult = m_aDocumentSizeCondition.wait(aTimeValue);
aResult = m_aDocumentSizeCondition.wait(std::chrono::seconds(2));
CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
// Verify deleted slides
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment