Kaydet (Commit) f58db441 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

Make this cross-platform.

üst 1fc21ed0
......@@ -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
}
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment