summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network/BoostIOServiceThread.cpp')
-rw-r--r--Swiften/Network/BoostIOServiceThread.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/Swiften/Network/BoostIOServiceThread.cpp b/Swiften/Network/BoostIOServiceThread.cpp
new file mode 100644
index 0000000..01c3bf3
--- /dev/null
+++ b/Swiften/Network/BoostIOServiceThread.cpp
@@ -0,0 +1,18 @@
+#include "Swiften/Network/BoostIOServiceThread.h"
+
+namespace Swift {
+
+BoostIOServiceThread::BoostIOServiceThread() : thread_(boost::bind(&BoostIOServiceThread::doRun, this)) {
+}
+
+BoostIOServiceThread::~BoostIOServiceThread() {
+ ioService_.stop();
+ thread_.join();
+}
+
+void BoostIOServiceThread::doRun() {
+ boost::asio::io_service::work work(ioService_);
+ ioService_.run();
+}
+
+}