I need it to be used with strnd.wrap() aswell. I've changed it to this again:
sau_timer::sau_timer(int secs, timerparam f) : strnd(io),
t(io, boost::posix_time::seconds(secs))
{
assert(secs > 0);
this->f = f;
t.async_wait(strnd.wrap(boost::bind(&sau_timer::exec, this, _1)));
boost::thread thrd(&io);
io.run();
}
void sau_timer::exec(const boost::system::error_code&) { (f)(params); }
But now I get these errors:
1>------ Build started: Project: Sauria, Configuration: Debug Win32 ------
1>Compiling...
1>sau_timer.cpp
1>Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
1>- add -D_WIN32_WINNT=0x0501 to the compiler command line; or
1>- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.
1>Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
1>c:\program files\boost\boost_1_39\boost\bind\bind.hpp(246) : error C2064: term does not evaluate to a function taking 1 arguments
1> c:\program files\boost\boost_1_39\boost\bind\bind_template.hpp(20) : see reference to function template instantiation 'void boost::_bi::list1<A1>::operator ()<F,boost::_bi::list0>(boost::_bi::type<T>,F &,A &,int)' being compiled
1> with
1> [
1> A1=boost::_bi::value<sau_timer *>,
1> F=boost::asio::io_service *,
1> T=void,
1> A=boost::_bi::list0
1> ]
1> c:\program files\boost\boost_1_39\boost\bind\bind_template.hpp(18) : while compiling class template member function 'void boost::_bi::bind_t<R,F,L>::operator ()(void)'
1> with
1> [
1> R=void,
1> F=boost::asio::io_service *,
1> L=boost::_bi::list1<boost::_bi::value<sau_timer *>>
1> ]
1> c:\program files\boost\boost_1_39\boost\thread\detail\thread.hpp(227) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
1> with
1> [
1> R=void,
1> F=boost::asio::io_service *,
1> L=boost::_bi::list1<boost::_bi::value<sau_timer *>>
1> ]
1> c:\users\ben\documents\visual studio 2008\projects\sauria\sauria\sau_timer.cpp(11) : see reference to function template instantiation 'boost::thread::thread<boost::asio::io_service*,sau_timer*>(F,A1)' being compiled
1> with
1> [
1> F=boost::asio::io_service *,
1> A1=sau_timer *
1> ]
1>Build log was saved at "file://c:\Users\Ben\Documents\Visual Studio 2008\Projects\Sauria\Sauria\Debug\BuildLog.htm"
1>Sauria - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========