summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-09-29 20:51:05 +0200
committerJan Holesovsky <kendy@suse.cz>2011-09-29 20:51:45 +0200
commitf58db44198a3e98e0e113b940da86c313cfccd80 (patch)
tree8a2522e7ba83eccd7a6fc5428d12f07079110537 /sal
parent1fc21ed077d3746dbff3acf3bc5eb9d6dd9f21b4 (diff)
Make this cross-platform.
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/osl/mutex/osl_Mutex.cxx28
-rw-r--r--sal/qa/osl/pipe/osl_Pipe.cxx12
2 files changed, 14 insertions, 26 deletions
diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx
index 74bd646c9f9e..10a95c1ceca9 100644
--- a/sal/qa/osl/mutex/osl_Mutex.cxx
+++ b/sal/qa/osl/mutex/osl_Mutex.cxx
@@ -68,32 +68,22 @@ inline void printBool( sal_Bool bOk )
*/
namespace ThreadHelper
{
- void thread_sleep( sal_Int32 _nSec )
+ void thread_sleep_tenth_sec(sal_uInt32 _nTenthSec)
+ {
+ TimeValue nTV;
+ nTV.Seconds = _nTenthSec/10;
+ nTV.Nanosec = ( (_nTenthSec%10 ) * 100000000 );
+ osl_waitThread(&nTV);
+ }
+ void thread_sleep( sal_uInt32 _nSec )
{
/// print statement in thread process must use fflush() to force display.
// t_print("# wait %d seconds. ", _nSec );
fflush(stdout);
-#ifdef WNT //Windows
- Sleep( _nSec * 1000 );
-#endif
-#if ( defined UNX ) //Unix
- sleep( _nSec );
-#endif
+ thread_sleep_tenth_sec( _nSec * 10 );
// printf("# done\n" );
}
- void thread_sleep_tenth_sec(sal_Int32 _nTenthSec)
- {
-#ifdef WNT //Windows
- Sleep(_nTenthSec * 100 );
-#endif
-#if ( defined UNX ) //Unix
- TimeValue nTV;
- nTV.Seconds = static_cast<sal_uInt32>( _nTenthSec/10 );
- nTV.Nanosec = ( (_nTenthSec%10 ) * 100000000 );
- osl_waitThread(&nTV);
-#endif
- }
}
diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx
index 210cbeaea124..8ca5bc09a411 100644
--- a/sal/qa/osl/pipe/osl_Pipe.cxx
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx
@@ -881,18 +881,16 @@ namespace osl_StreamPipe
/** wait _nSec seconds.
*/
- void thread_sleep( sal_Int32 _nSec )
+ void thread_sleep( sal_uInt32 _nSec )
{
/// print statement in thread process must use fflush() to force display.
// printf("wait %d seconds. ", _nSec );
fflush(stdout);
-#ifdef WNT //Windows
- Sleep( _nSec * 1000 );
-#endif
-#if ( defined UNX ) //Unix
- sleep( _nSec );
-#endif
+ TimeValue nTV;
+ nTV.Seconds = _nSec;
+ nTV.Nanosec = 0;
+ osl_waitThread(&nTV);
// printf("done\n" );
}
// test read/write & send/recv data to pipe