diff options
Diffstat (limited to 'Swiften/Network/BoostIOServiceThread.cpp')
-rw-r--r-- | Swiften/Network/BoostIOServiceThread.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Swiften/Network/BoostIOServiceThread.cpp b/Swiften/Network/BoostIOServiceThread.cpp index 50fe9a8..031e7b5 100644 --- a/Swiften/Network/BoostIOServiceThread.cpp +++ b/Swiften/Network/BoostIOServiceThread.cpp @@ -6,19 +6,24 @@ #include "Swiften/Network/BoostIOServiceThread.h" +#include <boost/smart_ptr/make_shared.hpp> + namespace Swift { -BoostIOServiceThread::BoostIOServiceThread() : thread_(boost::bind(&BoostIOServiceThread::doRun, this)) { +BoostIOServiceThread::BoostIOServiceThread() { + ioService_ = boost::make_shared<boost::asio::io_service>(); + thread_ = new boost::thread(boost::bind(&BoostIOServiceThread::doRun, this)); } BoostIOServiceThread::~BoostIOServiceThread() { - ioService_.stop(); - thread_.join(); + ioService_->stop(); + thread_->join(); + delete thread_; } void BoostIOServiceThread::doRun() { - boost::asio::io_service::work work(ioService_); - ioService_.run(); + boost::asio::io_service::work work(*ioService_); + ioService_->run(); } } |