You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
593 B

#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