Fix TimedConditionVariable hanging forever when now() > max_blocking_time #1000
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm targetting the PR to
1.9.x
just because it's the branch where I was working on.The same probably applies to master.
The original code did:
overflows when max_blocking_time has already passed.
I've carefully checked that that was the cause of the hang I was experimenting (I printed everything and checked values, it was overflowing).
Here backtraces of such a hung (thread 1 and thread 2 are the problem).
Extra comment:
The return type of
wait_until
when a predicate is not passed should bestd::cv_status
, and notbool
(see here). I'm not fixing that here, and returningfalse
when timeout happens (same was happening before as return value ofpthread_cond_timedwait
is not0
when timout happens).Bottom line: Why not just using
std::condition_variable_any
? Is because a compiler not supporting it? I see that that's actually being used in not linux systems.