[Libreoffice-commits] .: sal/qa

Jan Holesovsky kendy at kemper.freedesktop.org
Thu Sep 29 11:51:56 PDT 2011


 sal/qa/osl/mutex/osl_Mutex.cxx |   28 +++++++++-------------------
 sal/qa/osl/pipe/osl_Pipe.cxx   |   12 +++++-------
 2 files changed, 14 insertions(+), 26 deletions(-)

New commits:
commit f58db44198a3e98e0e113b940da86c313cfccd80
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Thu Sep 29 20:51:05 2011 +0200

    Make this cross-platform.

diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx
index 74bd646..10a95c1 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 210cbea..8ca5bc0 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


More information about the Libreoffice-commits mailing list