On 11/18/2012 12:13 PM, Igor R wrote:
I was curious if some boost::asio guru would mind checking this out. I just posted my code in, I'd like to know if there's anything that could be done better.
I'm not a guru, but pay attention to 2 points: 1) If _buffers container has several elements, HandleWrite() won't call Write() anymore. In other words, _writing state flag handling is incorrect: the flag should be reset unconditionally in HandleWrite(). 2) The access to _buffers container is not synchronized, so you may call Client::Write() only from the thread that executes io_service::run().
Awesome, thanks. I appreciate both. I'm not totally sure what you mean--I need to lock the thread? My system will have multiple servers running under it. I create services and feed them to a manager which calls Start. This spawns a thread per service. Then I call service.run. Is that going to block the main thread? Is there a way to do what I'm trying--run a thread per server? Thanks,
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.