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

Nobody has claimed this yet.

Assessment

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

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.

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.

Dominant language
C++
Stars
213
Forks
171
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/thread

All issues in boostorg/thread

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.