Compilation failure with MOODYCAMEL_NO_THREAD_LOCAL defined

Author: apolukhinCreated Feb 5, 2026Updated Feb 14, 2026

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

Source: cameron314/concurrentqueue