I am trying to capsulate a thread as it is shown here: http://antonym.org/2009/05/threading-with-boost---part-i-creating-threads.html
But somehow I can't even compile my program.. This:
/**
*
*/
void AcceptConnectionThread::start(int param)
{
m_thread = boost::thread(&AcceptConnectionThread::AcceptConnectionThreadRun, this, 0);
}
/**
*
*/
int AcceptConnectionThread::AcceptConnectionThreadRun()
{
return 0;
}
just gives me this:
Description Resource Path Location Type required from `boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F, L>::operator()() [with R = void; F = int (*)(); L = boost::_bi::list2<boost::_bi::value<AcceptConnectionThread*>, boost::_bi::value<int> >; boost::_bi::bind_t<R, F, L>::result_type = void]’ ServerNetwork line 20, external location: /usr/include/boost/bind/bind_template.hpp C/C++ Problem
Description Resource Path Location Type required from ‘void boost::detail::thread_data<F>::run() [with F = boost::_bi::bind_t<void, int (*)(), boost::_bi::list2<boost::_bi::value<AcceptConnectionThread*>, boost::_bi::value<int> > >]’ ServerNetwork line 62, external location: /usr/include/boost/thread/detail/thread.hpp C/C++ Problem
Description Resource Path Location Type too many arguments to function ServerNetwork line 313, external location: /usr/include/boost/bind/bind.hpp C/C++ Problem
This is the template-constructor that is used:
template <class F,class A1,class A2>
thread(F f,A1 a1,A2 a2):
thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2)))
{
start_thread();
}
I really do not have any idea what the problem is..
EDIT:
Anyway, it works with this.. but this way I can't pass any parameter..
/**
*
*/
void AcceptConnectionThread::start(int param)
{
m_thread = boost::thread(&AcceptConnectionThread::AcceptConnectionThreadRun);
}