On 20/05/2012 16:08, Igor R wrote:
Currently I'm developing a server that uses Boost.Asio, version 1.49. It makes use of io_service::post and io_service::dispatch to invoke handlers running in the same process, but on different threads. Some of the handlers invoke a function with the following signature:
void handler(std::string s);
This works fine and no problems have been observed. However, subsequently I read in the asio documentation that the function signature of a handler invoked by post/dispatch *must* be in the following format:
void handler();
Is my code working by chance or is the asio version 1.49 documentation out of date?
io_service::post() accepts nullary functors. So if your handler accept parameters, I guess you bind them at when posting the handler, don't you. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Yes, this is the sort of thing that I'm doing and that I find to be working OK. ios.post(boost::bind(&MyClass::Handler,ptr_to_my_class,"astring")); So, this is OK?