cameron314 / cameron314/concurrentqueue

Compilation failure with MOODYCAMEL_NO_THREAD_LOCAL defined

Open
#439 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
12.5k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

When using 1.0.4 versoion with MOODYCAMEL_NO_THREAD_LOCAL defined the following error happens:

In file included from /home/runner/.conan2/p/b/uservc7f05ee017e21/b/core/include/userver/concurrent/queue.hpp:10,
                 from /home/runner/.conan2/p/b/uservc7f05ee017e21/b/core/include/userver/clients/http/request.hpp:14,
                 from /home/runner/.conan2/p/b/uservc7f05ee017e21/b/core/include/userver/clients/http/client.hpp:10,
                 from /home/runner/.conan2/p/b/uservc7f05ee017e21/b/core/src/clients/config/client.cpp:3:
/home/runner/.conan2/p/concu0e8c745f17630/p/include/moodycamel/concurrentqueue.h: In member function ‘moodycamel::ConcurrentQueue<T, Traits>::ImplicitProducer* moodycamel::ConcurrentQueue<T, Traits>::get_or_add_implicit_producer()’:
/home/runner/.conan2/p/concu0e8c745f17630/p/include/moodycamel/concurrentqueue.h:3429:82: error: ‘invalid_thread_id2’ is not a member of ‘moodycamel::details’; did you mean ‘invalid_thread_id’?
 3429 |                                                         auto reusable = details::invalid_thread_id2;
      |                                                                                  ^~~~~~~~~~~~~~~~~~
      |                                                                                  invalid_thread_id
/home/runner/.conan2/p/concu0e8c745f17630/p/include/moodycamel/concurrentqueue.h:3512:66: error: ‘invalid_thread_id2’ is not a member of ‘moodycamel::details’; did you mean ‘invalid_thread_id’?
 3512 |                                         auto reusable = details::invalid_thread_id2;
      |                                                                  ^~~~~~~~~~~~~~~~~~
      |                                                                  invalid_thread_id
/home/runner/.conan2/p/concu0e8c745f17630/p/include/moodycamel/concurrentqueue.h: In member function ‘void moodycamel::ConcurrentQueue<T, Traits>::implicit_producer_thread_exited(moodycamel::ConcurrentQueue<T, Traits>::ImplicitProducer*)’:
/home/runner/.conan2/p/concu0e8c745f17630/p/include/moodycamel/concurrentqueue.h:3555:106: error: ‘invalid_thread_id2’ is not a member of ‘moodycamel::details’; did you mean ‘invalid_thread_id’?
 3555 |                                 if (hash->entries[index].key.compare_exchange_strong(probedKey, details::invalid_thread_id2, std::memory_order_seq_cst, std::memory_order_relaxed)) {
      |                                                                                                          ^~~~~~~~~~~~~~~~~~
      |                                                                                                          invalid_thread_id

Probably the MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED should not be defined if MOODYCAMEL_NO_THREAD_LOCAL is defined.

P.S.: we use the concurrentqueue with stackful coroutines that migrate between OS threeads. Unforunately, compilers cache TLS register value before suspension point. As a result, if thread_local is enabled, the coroutine after resume uses thread local variables of another thread

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.

Research direction

Start in the vendored concurrentqueue.h code around get_or_add_implicit_producer() and implicit_producer_thread_exited(), and inspect how MOODYCAMEL_NO_THREAD_LOCAL and MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED define invalid thread IDs. Reproduce the build with MOODYCAMEL_NO_THREAD_LOCAL enabled; done means the affected C++11 configuration compiles while preserving the intended non-TLS behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.