removed ifdef for the different sleep methods. Now only usleep is used, on all systems. Patch from Phenom

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7629 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-10-24 21:31:58 +00:00
parent c17de671bb
commit 880efee332
12 changed files with 57 additions and 129 deletions

View file

@ -746,11 +746,7 @@ bool RsDirUtil::renameFile(const std::string& from, const std::string& to)
#endif
/* set errno? */
return false ;
#ifdef WIN32
Sleep(200); /* 200 milliseconds */
#else
usleep(100000); /* 100000 microseconds */
#endif
usleep(100 * 1000); // 100 msec
if (loops >= 30)
return false ;
@ -956,11 +952,7 @@ RsStackFileLock::RsStackFileLock(const std::string& file_path)
while(RsDirUtil::createLockFile(file_path,_file_handle))
{
std::cerr << "Cannot acquire file lock " << file_path << ", waiting 1 sec." << std::endl;
#ifdef WINDOWS_SYS
Sleep(1000) ;
#else
sleep(1) ;
#endif
sleep(1 * 1000 * 1000) ; // 1 sec
}
#ifdef RSDIR_DEBUG
std::cerr << "Acquired file handle " << _file_handle << ", lock file:" << file_path << std::endl;
@ -1364,11 +1356,7 @@ bool RsDirUtil::renameWideFile(const std::wstring& from, const std::wstring& to)
#endif
/* set errno? */
return false ;
#ifdef WIN32
Sleep(100000); /* us */
#else
usleep(100000); /* us */
#endif
usleep(100 * 1000); //100 msec
if (loops >= 30)
return false ;

View file

@ -26,8 +26,8 @@
#include "rsthreads.h"
#include <unistd.h> /* for usleep() */
#include <errno.h> /* for usleep() */
#include <unistd.h> // for usleep()
#include <errno.h> // for errno
#include <iostream>
#include <time.h>
@ -35,10 +35,6 @@
#include <stdio.h>
#endif
#if defined(WINDOWS_SYS) && defined(__MINGW64_VERSION_MAJOR)
#include <windows.h> // for Sleep
#endif
/*******
* #define DEBUG_THREADS 1
* #define RSMUTEX_ABORT 1 // Catch wrong pthreads mode.
@ -176,11 +172,7 @@ void RsQueueThread::run()
std::cerr << std::endl;
#endif
}
#ifdef WIN32
Sleep(mLastSleep);
#else
usleep(1000 * mLastSleep);
#endif
usleep(mLastSleep * 1000); // mLastSleep msec
}
}