ADTF
Loading...
Searching...
No Matches
wait_until.h
Go to the documentation of this file.
1
7#pragma once
8#include <chrono>
9#include <thread>
10
11namespace adtf
12{
13
14namespace testing
15{
16
17namespace mega
18{
19
27template <typename Callable>
28bool wait_until(Callable&& oCallable,
29 std::chrono::milliseconds tmTimeOut,
30 std::chrono::milliseconds tmInterval = std::chrono::milliseconds{100})
31{
32 auto tmStart = std::chrono::high_resolution_clock::now();
33 for (;;)
34 {
35 if (oCallable())
36 {
37 return true;
38 }
39
40 if (std::chrono::high_resolution_clock::now() - tmStart > tmTimeOut)
41 {
42 return false;
43 }
44
45 std::this_thread::sleep_for(tmInterval);
46 }
47}
48
49}
50
52
53}
54}
Namespace for the ADTF Testing SDK.
Definition test_runtime.h:27
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
bool wait_until(Callable &&oCallable, std::chrono::milliseconds tmTimeOut, std::chrono::milliseconds tmInterval=std::chrono::milliseconds{100})
Definition wait_until.h:28