summaryrefslogtreecommitdiff
path: root/sal/qa
diff options
context:
space:
mode:
authorKevin Dubrulle <kevin.dubrulle@gmail.com>2018-07-07 13:34:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-08 11:48:40 +0200
commitd0f44d8ba7e87aa263008d3cfc4e68294d783162 (patch)
tree8527c62fb066366df2b40386c6544e670aa10a1a /sal/qa
parenta2193f8f33565cc896592acb9d3ab65c756d97fb (diff)
tdf#84323 - sal - add sane sleep interface: cleanup osl_waitThread
Replace osl_waitThread by osl::Thread::wait. Use std::chrono instead of TimeValue. Change-Id: I71691d014feeeb0c5d0ba29d048bda8e25e6e7dd Reviewed-on: https://gerrit.libreoffice.org/57130 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/qa')
-rw-r--r--sal/qa/osl/mutex/osl_Mutex.cxx5
-rw-r--r--sal/qa/osl/pipe/osl_Pipe.cxx5
-rw-r--r--sal/qa/osl/process/osl_Thread.cxx9
-rw-r--r--sal/qa/rtl/doublelock/rtl_doublelocking.cxx10
4 files changed, 4 insertions, 25 deletions
diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx
index 90f5b31e2c79..c9959038c5ea 100644
--- a/sal/qa/osl/mutex/osl_Mutex.cxx
+++ b/sal/qa/osl/mutex/osl_Mutex.cxx
@@ -34,10 +34,7 @@ namespace ThreadHelper
{
void thread_sleep_tenth_sec(sal_uInt32 _nTenthSec)
{
- TimeValue nTV;
- nTV.Seconds = _nTenthSec/10;
- nTV.Nanosec = ( (_nTenthSec%10 ) * 100000000 );
- osl_waitThread(&nTV);
+ osl::Thread::wait(std::chrono::milliseconds(_nTenthSec * 100));
}
void thread_sleep( sal_uInt32 _nSec )
{
diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx
index ea29fdd7c742..dbd224e50da5 100644
--- a/sal/qa/osl/pipe/osl_Pipe.cxx
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx
@@ -743,10 +743,7 @@ namespace osl_StreamPipe
/// print statement in thread process must use fflush() to force display.
fflush(stdout);
- TimeValue nTV;
- nTV.Seconds = _nSec;
- nTV.Nanosec = 0;
- osl_waitThread(&nTV);
+ osl::Thread::wait(std::chrono::seconds(_nSec));
}
// test read/write & send/recv data to pipe
diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx
index 396aa86efdb4..e5c9680cf35b 100644
--- a/sal/qa/osl/process/osl_Thread.cxx
+++ b/sal/qa/osl/process/osl_Thread.cxx
@@ -180,14 +180,7 @@ namespace ThreadHelper
{
void thread_sleep_tenth_sec(sal_Int32 _nTenthSec)
{
-#ifdef _WIN32
- Sleep(_nTenthSec * 100 );
-#else
- TimeValue nTV;
- nTV.Seconds = static_cast<sal_uInt32>( _nTenthSec/10 );
- nTV.Nanosec = ( (_nTenthSec%10 ) * 100000000 );
- osl_waitThread(&nTV);
-#endif
+ osl::Thread::wait(std::chrono::milliseconds(_nTenthSec * 100));
}
void outputPriority(oslThreadPriority const& _aPriority)
diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
index f882b104c9bc..e37400ba7f8f 100644
--- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
+++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
@@ -67,15 +67,7 @@ namespace ThreadHelper
// printf("wait %d tenth seconds. ", _nTenthSec );
// fflush(stdout);
// }
-#ifdef _WIN32 //Windows
- Sleep(_nTenthSec * 100 );
-#endif
-#if ( defined UNX )
- TimeValue nTV;
- nTV.Seconds = static_cast<sal_uInt32>( _nTenthSec/10 );
- nTV.Nanosec = ( (_nTenthSec%10 ) * 100000000 );
- osl_waitThread(&nTV);
-#endif
+ osl::Thread::wait(std::chrono::milliseconds(_nTenthSec * 100));
// if (nVerbose == VERBOSE)
// {
// printf("done\n");