Tests: Add base tests to host timing

This commit is contained in:
Fernando Sahmkow 2020-02-08 12:48:57 -04:00
parent 62e35ffc0e
commit 0f8e5a1465
5 changed files with 241 additions and 41 deletions

View file

@ -9,6 +9,7 @@
#include <cstddef>
#include <mutex>
#include <thread>
#include "common/common_types.h"
namespace Common {
@ -28,8 +29,7 @@ public:
is_set = false;
}
template <class Duration>
bool WaitFor(const std::chrono::duration<Duration>& time) {
bool WaitFor(const std::chrono::nanoseconds& time) {
std::unique_lock lk{mutex};
if (!condvar.wait_for(lk, time, [this] { return is_set; }))
return false;