MCPcopy Create free account
hub / github.com/ad-freiburg/qlever / waiting_function

Function waiting_function

test/ConcurrentCacheTest.cpp:48–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47template <typename T>
48auto waiting_function(T result, size_t milliseconds,
49 StartStopSignal* signal = nullptr) {
50 return [result, signal, milliseconds]() {
51 if (signal) {
52 // signal that the operation has started
53 signal->hasStartedSignal_.notify();
54 }
55 std::this_thread::sleep_for(std::chrono::milliseconds{milliseconds});
56 if (signal) {
57 // wait for the test case to allow finishing the operation
58 signal->mayFinishSignal_.wait();
59 }
60 return result;
61 };
62}
63
64auto wait_and_throw_function(size_t milliseconds,
65 StartStopSignal* signal = nullptr) {

Callers 1

TESTFunction · 0.85

Calls 2

notifyMethod · 0.80
waitMethod · 0.45

Tested by

no test coverage detected