1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-09-28 21:10:45 +00:00
falk-werner_webfuse-provider/test/webfuse_provider/test_util/timeout_watcher.hpp
2020-06-21 21:18:43 +02:00

29 lines
593 B
C++

#ifndef WFP_TEST_TIMEOUT_WATCHER_HPP
#define WFP_TEST_TIMEOUT_WATCHER_HPP
#include <chrono>
#include <functional>
namespace webfuse_test
{
class TimeoutWatcher final
{
TimeoutWatcher(TimeoutWatcher const & other) = delete;
TimeoutWatcher& operator=(TimeoutWatcher const & other) = delete;
public:
explicit TimeoutWatcher(std::chrono::milliseconds timeout);
~TimeoutWatcher();
bool isTimeout();
void check();
bool waitUntil(std::function<bool()> predicate);
private:
std::chrono::milliseconds startedAt;
std::chrono::milliseconds timeout_;
};
}
#endif