[Libreoffice-commits] core.git: desktop/source helpcompiler/source sal/qa sd/qa vcl/qa vcl/source
Gurkaran
gurkran at gmail.com
Tue Mar 22 06:54:37 UTC 2016
desktop/source/deployment/misc/dp_misc.cxx | 4 ++--
helpcompiler/source/HelpCompiler.cxx | 7 ++-----
sal/qa/osl/thread/test_thread.cxx | 4 ++--
sd/qa/unit/misc-tests.cxx | 7 +++----
vcl/qa/cppunit/timer.cxx | 16 ++++------------
vcl/source/opengl/OpenGLContext.cxx | 4 ++--
6 files changed, 15 insertions(+), 27 deletions(-)
New commits:
commit 9e7447d39e356857ef5786b513e99cee79385247
Author: Gurkaran <gurkran at gmail.com>
Date: Tue Mar 22 03:25:02 2016 +0530
tdf#84323: Make osl::Thread::wait more readable
It is to improve the readability of calls to osl::Thread::wait.
Change-Id: I025d89abf8e84ca73ba08f001be3f45b86c89957
Signed-off-by: Gurkaran <gurkran at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/23416
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index 9930d6a..24f23a5 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -19,6 +19,7 @@
#include <config_folders.h>
#include <config_features.h>
+#include <chrono>
#include "dp_misc.h"
#include "dp_version.hxx"
@@ -458,8 +459,7 @@ Reference<XInterface> resolveUnoURL(
catch (const connection::NoConnectException &) {
if (i < 20)
{
- TimeValue tv = { 0 /* secs */, 500000000 /* nanosecs */ };
- ::osl::Thread::wait( tv );
+ ::osl::Thread::wait( std::chrono::milliseconds(500) );
}
else throw;
}
diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index 2a127fe..c25b69b 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -28,14 +28,11 @@
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include <osl/thread.hxx>
+#include <chrono>
static void impl_sleep( sal_uInt32 nSec )
{
- TimeValue aTime;
- aTime.Seconds = nSec;
- aTime.Nanosec = 0;
-
- osl::Thread::wait( aTime );
+ osl::Thread::wait( std::chrono::seconds(nSec) );
}
HelpCompiler::HelpCompiler(StreamTable &in_streamTable, const fs::path &in_inputFile,
const fs::path &in_src, const fs::path &in_zipdir, const fs::path &in_resCompactStylesheet,
diff --git a/sal/qa/osl/thread/test_thread.cxx b/sal/qa/osl/thread/test_thread.cxx
index 5030af1..12ddafc 100644
--- a/sal/qa/osl/thread/test_thread.cxx
+++ b/sal/qa/osl/thread/test_thread.cxx
@@ -24,6 +24,7 @@
#include "osl/conditn.hxx"
#include "osl/thread.hxx"
#include "osl/time.h"
+#include <chrono>
namespace {
@@ -62,8 +63,7 @@ public:
// terminates:
global.set();
// Give the spawned threads enough time to terminate:
- TimeValue const twentySeconds = { 20, 0 };
- osl::Thread::wait(twentySeconds);
+ osl::Thread::wait(std::chrono::seconds(20));
}
CPPUNIT_TEST_SUITE(Test);
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 0d34f50..ab5b45e 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -31,6 +31,7 @@
#include <controller/SlideSorterController.hxx>
#include <controller/SlsClipboard.hxx>
#include <controller/SlsPageSelector.hxx>
+#include <chrono>
using namespace ::com::sun::star;
@@ -85,8 +86,7 @@ sd::DrawDocShellRef SdMiscTest::Load(const OUString& rURL, sal_Int32 nFormat)
while (Scheduler::ProcessTaskScheduling(true));
if ((pSSVS = sd::slidesorter::SlideSorterViewShell::GetSlideSorter(pViewShell->GetViewShellBase())) != nullptr)
break;
- TimeValue aSleep(0, 100 * 1000000); // 100 msec
- osl::Thread::wait(aSleep);
+ osl::Thread::wait(std::chrono::milliseconds(100));
}
CPPUNIT_ASSERT(pSSVS);
@@ -126,8 +126,7 @@ void SdMiscTest::testTdf96708()
xSSController.GetClipboard().DoCopy();
// Now wait for timers to trigger creation of auto-layout
- TimeValue aSleep(0, 100 * 1000000); // 100 msec
- osl::Thread::wait(aSleep);
+ osl::Thread::wait(std::chrono::milliseconds(100));
Scheduler::ProcessTaskScheduling(true);
xSSController.GetClipboard().DoPaste();
diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx
index 0d3afa1..07fdc92 100644
--- a/vcl/qa/cppunit/timer.cxx
+++ b/vcl/qa/cppunit/timer.cxx
@@ -14,6 +14,7 @@
#include <osl/thread.hxx>
#include <salhelper/thread.hxx>
+#include <chrono>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
@@ -39,10 +40,7 @@ public:
}
virtual void SAL_CALL run() override
{
- TimeValue aWait;
- aWait.Seconds = mnSeconds;
- aWait.Nanosec = 1000000; // +1ms
- osl::Thread::wait( aWait );
+ osl::Thread::wait( std::chrono::seconds(mnSeconds) );
fprintf(stderr, "ERROR: WatchDog timer thread expired, failing the test!\n");
fflush(stderr);
CPPUNIT_ASSERT_MESSAGE("watchdog triggered", false);
@@ -90,10 +88,7 @@ public:
void TimerTest::testWatchdog()
{
// out-wait the watchdog.
- TimeValue aWait;
- aWait.Seconds = 12;
- aWait.Nanosec = 0;
- osl::Thread::wait( aWait );
+ osl::Thread::wait( std::chrono::seconds(12) );
}
#endif
@@ -339,10 +334,7 @@ public:
}
virtual void Invoke() override
{
- TimeValue aWait;
- aWait.Seconds = 1;
- aWait.Nanosec = 0;
- osl::Thread::wait( aWait );
+ osl::Thread::wait( std::chrono::seconds(1) );
mbSlow = true;
}
};
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 7f920c0..3da890a 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -8,6 +8,7 @@
*/
#include <config_opengl.h>
+#include <chrono>
#include <vcl/opengl/OpenGLContext.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
@@ -1543,8 +1544,7 @@ void OpenGLContext::swapBuffers()
if (bSleep)
{
// half a second.
- TimeValue aSleep( 0, 500*1000*1000 );
- osl::Thread::wait( aSleep );
+ osl::Thread::wait( std::chrono::milliseconds(500) );
}
}
More information about the Libreoffice-commits
mailing list