For instance I have next code:
void waitForResponse(const std::optional<int64_t>& ms){
std::unique_lock lk{_mtx};
_cv.wait_for(lk, std::chrono::milliseconds{ms ? *ms : 0}, []() {
return someCondition;
}
}
Is it specified in standard if I pass 0
as a duration argument? Is it equal to the next code?:
void waitForResponse(const std::optional<int64_t>& ms){
std::unique_lock lk{_mtx};
_cv.wait_for(lk, []() {
return someCondition;
}
}
Is there any overhead?