|
Boost Users : |
From: Jeanette C. (julien_at_[hidden])
Date: 2022-05-21 18:36:04
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#thread.thread_management.tutorial.attributes
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)
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net