Comment.
[dcpomatic.git] / src / lib / server.cc
index 260f2e469aeacad2bfd39d71030e05c28e50dc72..f0b2d9816eedf581178853c72b873c8622649476 100644 (file)
@@ -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,17 @@ 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 ();
        if (_broadcast.thread) {
+               DCPOMATIC_ASSERT (_broadcast.thread->joinable ());
                _broadcast.thread->join ();
        }
 }