usleep: use nanosleep instead of usleep as the usleep is obsolete. Ticket: #2283

This commit is contained in:
Daniel Marjamäki 2010-12-30 21:35:53 +01:00
parent 8bdb05da6e
commit dfc7a13286
1 changed files with 7 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#include <cstring>
#include <cstdio>
#include <errno.h>
#include <time.h>
#endif
ThreadExecutor::ThreadExecutor(const std::vector<std::string> &filenames, const Settings &settings, ErrorLogger &errorLogger)
@ -190,7 +191,12 @@ unsigned int ThreadExecutor::check()
if (readRes == -1)
break;
else if (readRes == 0)
usleep(5000); // 5 ms
{
struct timespec duration;
duration.tv_sec = 0;
duration.tv_nsec = 5 * 1000 * 1000; // 5 ms
nanosleep(&duration, NULL);
}
}
int stat = 0;