Boost C++ Libraries: Ticket #10878: boost::thread::attributes -> no non-variadic-support https://svn.boost.org/trac10/ticket/10878 <p> In terms of applying thread attributes right now the documentation describes only this signature: </p> <p> template&lt;typename Callable&gt; thread(attributes&amp; attrs, Callable func); </p> <p> but this does not work when variadics are not supported (leading to error: type 'boost::thread_attributes' does not provide a call operator) </p> <p> Nevertheless, this temporaray way works out: </p> <p> thread(attributes&amp; attrs, boost::bind(Callable func)); </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10878 Trac 1.4.3 viboes Sun, 07 Jun 2015 08:52:00 GMT owner, status, component changed https://svn.boost.org/trac10/ticket/10878#comment:1 https://svn.boost.org/trac10/ticket/10878#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>component</strong> <span class="trac-field-old">threads</span> → <span class="trac-field-new">thread</span> </li> </ul> <p> Please, don't use the threads component but the thread one. </p> Ticket viboes Sat, 05 Sep 2015 14:51:18 GMT <link>https://svn.boost.org/trac10/ticket/10878#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10878#comment:2</guid> <description> <p> Please, could you give an example and the compiler error you are getting. </p> <p> I see on the develop branch this overload that should avoid the issue </p> <pre class="wiki"> template &lt;class F,class A1&gt; thread(F f,A1 a1,typename disable_if&lt;boost::thread_detail::is_convertible&lt;F&amp;,thread_attributes &gt;, dummy* &gt;::type=0): thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1))) { start_thread(); } </pre> </description> <category>Ticket</category> </item> <item> <author>jazzalex <alexander.carot@…></author> <pubDate>Fri, 02 Sep 2016 20:55:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10878#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10878#comment:3</guid> <description> <p> Sure: If I do this: </p> <p> boost::thread::attributes attrs; </p> <p> #if defined(BOOST_THREAD_PLATFORM_WIN32) </p> <p> bool res; </p> <p> res = <a class="missing wiki">SetThreadPriority</a>(attrs.native_handle(),THREAD_PRIORITY_TIME_CRITICAL); </p> <p> #elif defined(BOOST_THREAD_PLATFORM_PTHREAD) </p> <p> pthread_attr_setschedpolicy(attrs.native_handle(), SCHED_FIFO); </p> <p> #endif </p> <p> sendThread = boost::thread(attrs,&amp;sender::sendItThreadFunction,this); </p> <p> I get the following compiler error(s): </p> <p> 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 </p> <blockquote> <p> unwrapper&lt;F&gt;::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); <sup><del></del><del></del><del></del><del></del><del></del><del></del>~ </sup></p> </blockquote> <p> ./include/boost_1_61_0/boost/bind/bind.hpp:1222:16: note: in instantiation of function template specialization 'boost::_bi::list2&lt;boost::_bi::value&lt;void </p> <blockquote> <p> (sender::*)()&gt;, boost::_bi::value&lt;sender *&gt; &gt;::operator()&lt;boost::thread_attributes, boost::_bi::list0&gt;' requested here </p> <blockquote> <p> return l_( type&lt;result_type&gt;(), f_, a, 0 ); </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> </blockquote> <p> ./include/boost_1_61_0/boost/thread/detail/thread.hpp:116:17: note: in instantiation of member function 'boost::_bi::bind_t&lt;void, boost::thread_attributes, </p> <blockquote> <p> boost::_bi::list2&lt;boost::_bi::value&lt;void (sender::*)()&gt;, boost::_bi::value&lt;sender *&gt; &gt; &gt;::operator()' requested here </p> <blockquote> <p> f(); <sup> </sup></p> </blockquote> </blockquote> <p> ./include/boost_1_61_0/boost/thread/detail/thread.hpp:96:15: note: in instantiation of member function 'boost::detail::thread_data&lt;boost::_bi::bind_t&lt;void, </p> <blockquote> <p> boost::thread_attributes, boost::_bi::list2&lt;boost::_bi::value&lt;void (sender::*)()&gt;, boost::_bi::value&lt;sender *&gt; &gt; &gt; &gt;::run' requested here </p> <blockquote> <p> thread_data(BOOST_THREAD_RV_REF(F) f_): <sup> </sup></p> </blockquote> </blockquote> <p> ./include/boost_1_61_0/boost/thread/pthread/thread_heap_alloc.hpp:24:24: note: in instantiation of member function </p> <blockquote> <p> 'boost::detail::thread_data&lt;boost::_bi::bind_t&lt;void, boost::thread_attributes, boost::_bi::list2&lt;boost::_bi::value&lt;void (sender::*)()&gt;, boost::_bi::value&lt;sender *&gt; &gt; &gt; &gt;::thread_data' requested here </p> <blockquote> <p> return new T(static_cast&lt;A1&amp;&amp;&gt;(a1)); </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> </blockquote> <p> ./include/boost_1_61_0/boost/thread/detail/thread.hpp:211:52: note: in instantiation of function template specialization </p> <blockquote> <p> 'boost::detail::heap_new&lt;boost::detail::thread_data&lt;boost::_bi::bind_t&lt;void, boost::thread_attributes, boost::_bi::list2&lt;boost::_bi::value&lt;void (sender::*)()&gt;, boost::_bi::value&lt;sender *&gt; &gt; &gt; &gt;, boost::_bi::bind_t&lt;void, boost::thread_attributes, boost::_bi::list2&lt;boost::_bi::value&lt;void (sender::*)()&gt;, boost::_bi::value&lt;sender *&gt; &gt; &gt; &gt;' requested here </p> <blockquote> <p> return detail::thread_data_ptr(detail::heap_new&lt;detail::thread_data&lt;typename boost::remove_reference&lt;F&gt;::type&gt; &gt;( </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> </blockquote> <p> ./include/boost_1_61_0/boost/thread/detail/thread.hpp:397:25: note: in instantiation of function template specialization </p> <blockquote> <p> 'boost::thread::make_thread_info&lt;boost::_bi::bind_t&lt;void, boost::thread_attributes, boost::_bi::list2&lt;boost::_bi::value&lt;void (sender::*)()&gt;, boost::_bi::value&lt;sender *&gt; &gt; &gt; &gt;' requested here </p> <blockquote> <p> thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1,a2))) </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> </blockquote> <p> sender.cpp:95:18: note: in instantiation of function template specialization </p> <blockquote> <p> 'boost::thread::thread&lt;boost::thread_attributes, void (sender::*)(), sender *&gt;' requested here </p> </blockquote> <blockquote> <p> sendThread = boost::thread(attrs,&amp;sender::sendItThreadFunction,this); </p> </blockquote> <p> However, when I use this instead: </p> <p> sendThread = boost::thread(attrs, boost::bind(&amp;sender::sendItThreadFunction,this)); </p> <p> it is working perfectly fine. </p> <p> Does this help to track down the issue ? </p> <p> Thanks in advance and sorry again for the late reply </p> <p> Alex </p> </description> <category>Ticket</category> </item> </channel> </rss>