summaryrefslogtreecommitdiff
path: root/src/lib/server.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/server.cc')
-rw-r--r--src/lib/server.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/server.cc b/src/lib/server.cc
index c1db1e6ac..f0b2d9816 100644
--- a/src/lib/server.cc
+++ b/src/lib/server.cc
@@ -39,6 +39,7 @@
#include <libxml++/libxml++.h>
#include <boost/algorithm/string.hpp>
#include <boost/scoped_array.hpp>
+#include <boost/foreach.hpp>
#include <string>
#include <vector>
#include <iostream>
@@ -81,15 +82,19 @@ Server::~Server ()
_full_condition.notify_all ();
}
- for (vector<boost::thread*>::iterator i = _worker_threads.begin(); i != _worker_threads.end(); ++i) {
- (*i)->join ();
- delete *i;
+ BOOST_FOREACH (boost::thread* i, _worker_threads) {
+ DCPOMATIC_ASSERT (i->joinable ());
+ i->join ();
+ delete i;
}
_io_service.stop ();
_broadcast.io_service.stop ();
- _broadcast.thread->join ();
+ if (_broadcast.thread) {
+ DCPOMATIC_ASSERT (_broadcast.thread->joinable ());
+ _broadcast.thread->join ();
+ }
}
/** @param after_read Filled in with gettimeofday() after reading the input from the network.