usleep: use nanosleep instead of usleep as the usleep is obsolete. Ticket: #2283
This commit is contained in:
parent
8bdb05da6e
commit
dfc7a13286
|
@ -28,6 +28,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ThreadExecutor::ThreadExecutor(const std::vector<std::string> &filenames, const Settings &settings, ErrorLogger &errorLogger)
|
ThreadExecutor::ThreadExecutor(const std::vector<std::string> &filenames, const Settings &settings, ErrorLogger &errorLogger)
|
||||||
|
@ -190,7 +191,12 @@ unsigned int ThreadExecutor::check()
|
||||||
if (readRes == -1)
|
if (readRes == -1)
|
||||||
break;
|
break;
|
||||||
else if (readRes == 0)
|
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;
|
int stat = 0;
|
||||||
|
|
Loading…
Reference in New Issue