Different vftable size for boost::detail::shared_state_base regarding BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION

Open
#337 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start in thread/include/boost/thread/future.hpp around line 327 and compare the shared_state_base code with the precautions around lines 285 and 304. Verify mixed modules with and without BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION no longer produce differing vftable layouts or the reported linker warning.

Written by the indexing model from the issue text.

Description

Version of Boost: All of them, including 'master'

File: thread/include/boost/thread/future.hpp , around line 327

The matter is that this file contains the following portion of code (class boost::detail::shared_state_base):

#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
            virtual void set_continuation_ptr(continuation_ptr_type continuation, boost::unique_lock<boost::mutex>& lock)
            {
              continuations.push_back(continuation);
              if (done) {
                do_continuation(lock);
              }
            }
#endif

So the vftable layout depends on BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION macro, which leads to linker warning (and unpredictable runtime outcomes) when mixing code from two different modules, with only one of them using that macro.

There are some precautions about this issue before (see ll.285 and 304). It would be nice to have the same here.

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.