boostorg / boostorg/thread

condition_variable::timed_wait incompatible with std::chrono::duration due to lack of is_pos_infinity

Open
#410 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
214
Forks
171
PR merge metrics
No merged PRs in 30d

Description

boost::condition_variable::timed_wait() attempts to invoke wait_duration.is_pos_infinity() on its templated parameter.

The standard doesn't define a member is_pos_infinity expected by timed_wait, forcing one to use a Boost clock rather than an STL one such as steady_clock or system_clock.

https://en.cppreference.com/w/cpp/chrono/duration

Found when compiling with MSVS 2022's STL (line 200 here):

https://github.com/microsoft/STL/blob/main/stl/inc/__msvc_chrono.hpp

A possible workaround would be to define an adapter class that defines this member.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at boost::condition_variable::timed_wait and inspect how its templated duration parameter is handled. Compare that expectation with the standard std::chrono::duration interface and the linked MSVS STL definition; done means standard steady_clock or system_clock durations are accepted without requiring a Boost clock.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.