16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_THREADING_CONDITIONVARIABLEWRAPPER_H_ 17 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_THREADING_CONDITIONVARIABLEWRAPPER_H_ 21 #include <condition_variable> 22 #include <unordered_set> 46 return "ConditionVariableWrapper";
74 template <
typename Predicate>
75 void wait(std::unique_lock<std::mutex>& lock, Predicate pred);
93 template <
typename Rep,
typename Period,
typename Predicate>
95 std::unique_lock<std::mutex>& lock,
96 const std::chrono::duration<Rep, Period>& rel_time,
116 template <
typename Clock,
typename Duration,
typename Predicate>
118 std::unique_lock<std::mutex>& lock,
119 const std::chrono::time_point<Clock, Duration>& timeout_time,
129 void waitInner(std::unique_lock<std::mutex>& lock, std::function<
bool()> pred);
138 bool waitForInner(std::unique_lock<std::mutex>& lock, std::chrono::nanoseconds relTime, std::function<
bool()> pred);
141 static std::atomic<uint64_t> g_id;
147 std::condition_variable m_cv;
159 std::shared_ptr<power::PowerResource> m_notifyOnePowerResource;
165 uint64_t m_notifyOnePowerResourceRefCount;
168 std::unordered_set<std::shared_ptr<power::PowerResource>> m_frozenResources;
171 template <
typename Predicate>
173 waitInner(lock, pred);
176 template <
typename Rep,
typename Period,
typename Predicate>
178 std::unique_lock<std::mutex>& lock,
179 const std::chrono::duration<Rep, Period>& rel_time,
181 return waitForInner(lock, rel_time, pred);
184 template <
typename Clock,
typename Duration,
typename Predicate>
186 std::unique_lock<std::mutex>& lock,
187 const std::chrono::time_point<Clock, Duration>& timeout_time,
189 return waitForInner(lock, timeout_time - Clock::now(), pred);
197 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_THREADING_CONDITIONVARIABLEWRAPPER_H_ Definition: ConditionVariableWrapper.h:40
ConditionVariableWrapper()
Constructor.
void wait(std::unique_lock< std::mutex > &lock, Predicate pred)
Definition: ConditionVariableWrapper.h:172
bool waitFor(std::unique_lock< std::mutex > &lock, const std::chrono::duration< Rep, Period > &rel_time, Predicate pred)
Definition: ConditionVariableWrapper.h:177
::std::string string
Definition: gtest-port.h:1097
bool waitUntil(std::unique_lock< std::mutex > &lock, const std::chrono::time_point< Clock, Duration > &timeout_time, Predicate pred)
Definition: ConditionVariableWrapper.h:185
static std::string getTag()
Definition: ConditionVariableWrapper.h:45
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36