summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorGurkaran <gurkran@gmail.com>2016-03-22 03:25:02 +0530
committerNoel Grandin <noelgrandin@gmail.com>2016-03-22 06:54:08 +0000
commit9e7447d39e356857ef5786b513e99cee79385247 (patch)
tree12ab8cf850a2af5053959def004db5c463237008 /vcl
parent7f36f4ce9f9f3d430009ba472d275d038abecb16 (diff)
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@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/23416 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/timer.cxx16
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx4
2 files changed, 6 insertions, 14 deletions
diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx
index 0d3afa1ace8d..07fdc92ffbac 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 7f920c0370b7..3da890ae4e2e 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) );
}
}