Merge pull request #216 from kiwix/thread_win

Do not use this_thread::sleep.
This commit is contained in:
Matthieu Gautier 2019-04-17 17:56:56 +02:00 committed by GitHub
commit f93c31754a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -3,8 +3,7 @@
#include "aria2.h" #include "aria2.h"
#include "xmlrpc.h" #include "xmlrpc.h"
#include <sstream> #include <sstream>
#include <thread> #include <time.h>
#include <chrono>
#include <tools/otherTools.h> #include <tools/otherTools.h>
#include <tools/pathTools.h> #include <tools/pathTools.h>
#include <downloader.h> // For AriaError #include <downloader.h> // For AriaError
@ -82,7 +81,8 @@ Aria2::Aria2():
int watchdog = 50; int watchdog = 50;
while(--watchdog) { while(--watchdog) {
std::this_thread::sleep_for(std::chrono::microseconds(10000)); struct timespec wait = {0, 10000000};
nanosleep(&wait, nullptr);
auto res = curl_easy_perform(mp_curl); auto res = curl_easy_perform(mp_curl);
if (res == CURLE_OK) { if (res == CURLE_OK) {
break; break;