Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10878: boost::thread::attributes -> no non-variadic-support
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-09-02 20:55:32
#10878: boost::thread::attributes -> no non-variadic-support
-------------------------------+-----------------------------------------
Reporter: a.carot@⦠| Owner: viboes
Type: Feature Requests | Status: assigned
Milestone: To Be Determined | Component: thread
Version: Boost 1.57.0 | Severity: Problem
Resolution: | Keywords: thread,attributes,variadics
-------------------------------+-----------------------------------------
Comment (by jazzalex <alexander.carot@â¦>):
Sure: If I do this:
boost::thread::attributes attrs;
#if defined(BOOST_THREAD_PLATFORM_WIN32)
bool res;
res =
SetThreadPriority(attrs.native_handle(),THREAD_PRIORITY_TIME_CRITICAL);
#elif defined(BOOST_THREAD_PLATFORM_PTHREAD)
pthread_attr_setschedpolicy(attrs.native_handle(), SCHED_FIFO);
#endif
sendThread = boost::thread(attrs,&sender::sendItThreadFunction,this);
I get the following compiler error(s):
In file included from ./include/boost_1_61_0/boost/bind.hpp:22:
./include/boost_1_61_0/boost/bind/bind.hpp:319:9: error: type
'boost::thread_attributes' does not provide a call operator
unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/boost_1_61_0/boost/bind/bind.hpp:1222:16: note: in instantiation
of function template specialization
'boost::_bi::list2<boost::_bi::value<void
(sender::*)()>, boost::_bi::value<sender *>
>::operator()<boost::thread_attributes, boost::_bi::list0>' requested here
return l_( type<result_type>(), f_, a, 0 );
^
./include/boost_1_61_0/boost/thread/detail/thread.hpp:116:17: note: in
instantiation of member function 'boost::_bi::bind_t<void,
boost::thread_attributes,
boost::_bi::list2<boost::_bi::value<void (sender::*)()>,
boost::_bi::value<sender *> > >::operator()' requested here
f();
^
./include/boost_1_61_0/boost/thread/detail/thread.hpp:96:15: note: in
instantiation of member function
'boost::detail::thread_data<boost::_bi::bind_t<void,
boost::thread_attributes, boost::_bi::list2<boost::_bi::value<void
(sender::*)()>, boost::_bi::value<sender *> > > >::run' requested here
thread_data(BOOST_THREAD_RV_REF(F) f_):
^
./include/boost_1_61_0/boost/thread/pthread/thread_heap_alloc.hpp:24:24:
note: in instantiation of member function
'boost::detail::thread_data<boost::_bi::bind_t<void,
boost::thread_attributes, boost::_bi::list2<boost::_bi::value<void
(sender::*)()>,
boost::_bi::value<sender *> > > >::thread_data' requested here
return new T(static_cast<A1&&>(a1));
^
./include/boost_1_61_0/boost/thread/detail/thread.hpp:211:52: note: in
instantiation of function template specialization
'boost::detail::heap_new<boost::detail::thread_data<boost::_bi::bind_t<void,
boost::thread_attributes, boost::_bi::list2<boost::_bi::value<void
(sender::*)()>, boost::_bi::value<sender *> > > >,
boost::_bi::bind_t<void, boost::thread_attributes,
boost::_bi::list2<boost::_bi::value<void
(sender::*)()>, boost::_bi::value<sender *> > > >' requested here
return
detail::thread_data_ptr(detail::heap_new<detail::thread_data<typename
boost::remove_reference<F>::type> >(
^
./include/boost_1_61_0/boost/thread/detail/thread.hpp:397:25: note: in
instantiation of function template specialization
'boost::thread::make_thread_info<boost::_bi::bind_t<void,
boost::thread_attributes, boost::_bi::list2<boost::_bi::value<void
(sender::*)()>,
boost::_bi::value<sender *> > > >' requested here
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2)))
^
sender.cpp:95:18: note: in instantiation of function template
specialization
'boost::thread::thread<boost::thread_attributes, void (sender::*)(),
sender *>' requested here
sendThread = boost::thread(attrs,&sender::sendItThreadFunction,this);
However, when I use this instead:
sendThread = boost::thread(attrs,
boost::bind(&sender::sendItThreadFunction,this));
it is working perfectly fine.
Does this help to track down the issue ?
Thanks in advance and sorry again for the late reply
Alex
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10878#comment:3> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC