replaced usleep with sleep_for

This commit is contained in:
Erik Frojdh
2020-07-23 11:07:42 +02:00
parent 9ea8882c05
commit 78a6896ae9
4 changed files with 16 additions and 8 deletions

View File

@ -3,7 +3,8 @@
#include <errno.h>
#include <iostream>
#include <string.h>
#include <unistd.h> //usleep in some machines
#include <chrono>
#include <thread>
#include <vector>
#include <sstream>
#include <zmq.h>
@ -76,8 +77,8 @@ ZmqSocket::ZmqSocket(const uint32_t portnumber, const char *ethip)
PrintError();
throw sls::ZmqSocketError("Could not bind socket");
}
// sleep for a few milliseconds to allow a slow-joiner
usleep(200 * 1000);
// sleep to allow a slow-joiner
std::this_thread::sleep_for(std::chrono::milliseconds(200));
};
int ZmqSocket::Connect() {