diff options
Diffstat (limited to 'src/Net/ThreadManager.cpp')
-rw-r--r-- | src/Net/ThreadManager.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Net/ThreadManager.cpp b/src/Net/ThreadManager.cpp index 71a754e..0fb0716 100644 --- a/src/Net/ThreadManager.cpp +++ b/src/Net/ThreadManager.cpp @@ -18,11 +18,13 @@ */ #include "ThreadManager.h" -#include "FdManager.h" +#include "Connection.h" #include <Common/Logger.h> #include <Common/LogManager.h> +#include <boost/bind.hpp> + #include <fcntl.h> namespace Mad { @@ -97,10 +99,12 @@ void ThreadManager::doInit() { threadLock.lock(); + ioWorker.reset(new boost::asio::io_service::work(Connection::ioService)); + mainThreadId = boost::this_thread::get_id(); - workerThread = new boost::thread(std::mem_fun(&ThreadManager::workerFunc), this); - loggerThread = new boost::thread(std::mem_fun(&Common::LogManager::loggerThread), Common::LogManager::get()); - ioThread = new boost::thread(std::mem_fun(&FdManager::ioThread), FdManager::get()); + workerThread = new boost::thread(&ThreadManager::workerFunc, this); + loggerThread = new boost::thread(&Common::LogManager::loggerThread, Common::LogManager::get()); + ioThread = new boost::thread((std::size_t(boost::asio::io_service::*)())&boost::asio::io_service::run, &Connection::ioService); threadLock.unlock(); } @@ -128,7 +132,7 @@ void ThreadManager::doDeinit() { threads.join_all(); // IO thread is next - FdManager::get()->stopIOThread(); + ioWorker.reset(); ioThread->join(); delete ioThread; |