Another macOS std::list boost::thread SNAFU.
[dcpomatic.git] / src / lib / encode_server.cc
index e79f82b..5884df0 100644 (file)
@@ -87,12 +87,13 @@ EncodeServer::~EncodeServer ()
                _full_condition.notify_all ();
        }
 
                _full_condition.notify_all ();
        }
 
-       BOOST_FOREACH (boost::thread& i, _worker_threads) {
+       BOOST_FOREACH (boost::thread* i, _worker_threads) {
                try {
                try {
-                       i.join ();
+                       i->join ();
                } catch (...) {
 
                }
                } catch (...) {
 
                }
+               delete i;
        }
 
        {
        }
 
        {
@@ -233,9 +234,10 @@ EncodeServer::run ()
        }
 
        for (int i = 0; i < _num_threads; ++i) {
        }
 
        for (int i = 0; i < _num_threads; ++i) {
-               _worker_threads.push_back (thread(bind(&EncodeServer::worker_thread, this)));
+               boost::thread* t = new thread(bind(&EncodeServer::worker_thread, this));
+               _worker_threads.push_back (t);
 #ifdef DCPOMATIC_LINUX
 #ifdef DCPOMATIC_LINUX
-               pthread_setname_np (_worker_threads.back().native_handle(), "encode-server-worker");
+               pthread_setname_np (t->native_handle(), "encode-server-worker");
 #endif
        }
 
 #endif
        }