Fix bad sleep

This commit is contained in:
alesapin 2020-12-17 19:21:46 +03:00
parent e80b93939f
commit a207e3db75

View File

@ -9,6 +9,7 @@
#include <random> #include <random>
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
#include <chrono>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
@ -191,7 +192,8 @@ void createPathAndSetWatch(zkutil::ZooKeeper & zk, const String & path_prefix, s
std::lock_guard lock(elements_mutex); std::lock_guard lock(elements_mutex);
current_elements.push_back(element); current_elements.push_back(element);
} }
sleep(0.2);
std::this_thread::sleep_for(std::chrono::milliseconds(200));
{ {
std::lock_guard lock(elements_mutex); std::lock_guard lock(elements_mutex);
@ -227,7 +229,7 @@ void tryConcurrentWatches(zkutil::ZooKeeper & zk)
size_t counter = 0; size_t counter = 0;
while (watches_triggered != 100 * 100) while (watches_triggered != 100 * 100)
{ {
sleep(0.1); std::this_thread::sleep_for(std::chrono::milliseconds(100));
if (counter++ > 20) if (counter++ > 20)
break; break;
} }