[thread] attribute constructor failing to compile

Hey hey, using boost 1.78 from the Archlinux repository, using the thread constructor with boost::thread::attributes as first argument fails to compile. The relevant code from the small test program is this: void work(bool& done) // simple main function for the thread int main() { bool done = false; boost::thread::attributes attr; // all changes commented out in the program boost::thread th1(attr, work, std::ref(done)); // some code, sleep and set done to true th1.join(); return 0; } g++ 11.2.0 reports the following error: In file included from /usr/include/boost/thread/detail/thread.hpp:33, from /usr/include/boost/thread/thread_only.hpp:22, from /usr/include/boost/thread/thread.hpp:12, from thread_prio.cpp:1: /usr/include/boost/bind/bind.hpp: In instantiation of 'void boost::_bi::list2<A1, A2>::operator()(boost::_bi::type<void>, F&, A&, int) [with F = boost::thread_attributes; A = boost::_bi::list0; A1 = boost::_bi::value<int (*)(bool&)>; A2 = boost::_bi::value<std::reference_wrapper<bool> >]': /usr/include/boost/bind/bind.hpp:1273:18: required from 'boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F, L>::operator()() [with R = void; F = boost::thread_attributes; L = boost::_bi::list2<boost::_bi::value<int (*)(bool&)>, boost::_bi::value<std::reference_wrapper<bool> > >; boost::_bi::bind_t<R, F, L>::result_type = void]' /usr/include/boost/thread/detail/thread.hpp:120:18: required from 'void boost::detail::thread_data<F>::run() [with F = boost::_bi::bind_t<void, boost::thread_attributes, boost::_bi::list2<boost::_bi::value<int (*)(bool&)>, boost::_bi::value<std::reference_wrapper<bool> > > >]' /usr/include/boost/thread/detail/thread.hpp:118:18: required from here /usr/include/boost/bind/bind.hpp:298:35: error: no match for call to '(boost::thread_attributes) (int (*&)(bool&), std::reference_wrapper<bool>&)' 298 | unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The syntax is based on this part of the manual: https://www.boost.org/doc/libs/1_79_0/doc/html/thread/thread_management.html... Is that perhaps a feature only introduced in version 1.79 of the Boost libraries? Best wishes and thanks for any pointers, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c Don't care about money It doesn't give me half the thrill <3 (Britney Spears)

On Sat, May 21, 2022 at 2:51 PM Jeanette C. wrote:
Hey hey, using boost 1.78 from the Archlinux repository, using the thread constructor with boost::thread::attributes as first argument fails to compile.
It's as if BOOST_THREAD_PROVIDES_VARIADIC_THREAD is not defined, which would happen if BOOST_THREAD_VERSION is less than 4. Can you check if this is the case? Glen

May 21 2022, Glen Fernandes has written: ...
It's as if BOOST_THREAD_PROVIDES_VARIADIC_THREAD is not defined, which would happen if BOOST_THREAD_VERSION is less than 4. Can you check if this is the case? ... the version is 2, although the include files mention versions upto 5. What is the recommended way to set this, please?
Best wishes, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c Don't care about money It doesn't give me half the thrill <3 (Britney Spears)

It looks like the overload taking thread::attributes as parameter does not accept variadic arguments: ``` template<typename Callable> thread(attributes& attrs, Callable func); ``` https://www.boost.org/doc/libs/1_79_0/doc/html/thread/thread_management.html... On Sat, May 21, 2022 at 6:18 PM Jeanette C. via Boost-users < boost-users@lists.boost.org> wrote:
May 21 2022, Glen Fernandes has written: ...
It's as if BOOST_THREAD_PROVIDES_VARIADIC_THREAD is not defined, which would happen if BOOST_THREAD_VERSION is less than 4. Can you check if this is the case? ... the version is 2, although the include files mention versions upto 5. What is the recommended way to set this, please?
Best wishes,
Jeanette
-- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c
Don't care about money It doesn't give me half the thrill <3 (Britney Spears) _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Juan :wq
participants (3)
-
Glen Fernandes
-
Jeanette C.
-
Juan Ramírez