adamdebreceni commented on code in PR #1367:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1367#discussion_r950087185
##########
libminifi/include/utils/TimeUtil.h:
##########
@@ -70,6 +72,16 @@ class Clock {
public:
virtual ~Clock() = default;
virtual std::chrono::milliseconds timeSinceEpoch() const = 0;
+ virtual std::chrono::milliseconds wait_until(std::condition_variable& cv,
std::unique_lock<std::mutex>& lck, std::chrono::milliseconds time, const
std::function<bool()>& pred) {
+ auto now = timeSinceEpoch();
+ if (now < time) {
+ cv.wait_for(lck, time - now, [&] {
+ now = timeSinceEpoch();
+ return now >= time || pred();
+ });
+ }
+ return timeSinceEpoch();
Review Comment:
yes it makes sense to be inline with the interface of
`std::condition_variable::wait_until`, changed it to return a `bool`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]