Merge pull request 'cond_var' (#42) from cond_var into master

Reviewed-on: https://git.shs.tools/SHS/pip/pulls/42
This commit was merged in pull request #42.
This commit is contained in:
2020-09-25 13:34:16 +03:00
2 changed files with 25 additions and 14 deletions

View File

@@ -14,9 +14,7 @@ public:
void wait(PIMutex& lk, const std::function<bool()>& condition) override {
isWaitCalled = true;
lk.lock();
isTrueCondition = condition();
lk.unlock();
}
bool waitFor(PIMutex& lk, int timeoutMs) override {
@@ -27,10 +25,8 @@ public:
bool waitFor(PIMutex& lk, int timeoutMs, const std::function<bool()>& condition) override {
isWaitForCalled = true;
lk.lock();
isTrueCondition = condition();
timeout = timeoutMs;
lk.unlock();
return isTrueCondition;
}
};