From f515b8daea9d28200be803bb64ff17e9f30343c4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 19 Feb 2020 22:22:23 +0100 Subject: [PATCH 1/1] Another macOS std::list boost::thread SNAFU. --- src/lib/encode_server.cc | 10 ++++++---- src/lib/encode_server.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/encode_server.cc b/src/lib/encode_server.cc index e79f82b62..5884df09a 100644 --- a/src/lib/encode_server.cc +++ b/src/lib/encode_server.cc @@ -87,12 +87,13 @@ EncodeServer::~EncodeServer () _full_condition.notify_all (); } - BOOST_FOREACH (boost::thread& i, _worker_threads) { + BOOST_FOREACH (boost::thread* i, _worker_threads) { try { - i.join (); + i->join (); } catch (...) { } + delete i; } { @@ -233,9 +234,10 @@ EncodeServer::run () } 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 - pthread_setname_np (_worker_threads.back().native_handle(), "encode-server-worker"); + pthread_setname_np (t->native_handle(), "encode-server-worker"); #endif } diff --git a/src/lib/encode_server.h b/src/lib/encode_server.h index 40e84ad60..91e007503 100644 --- a/src/lib/encode_server.h +++ b/src/lib/encode_server.h @@ -54,7 +54,7 @@ private: void broadcast_thread (); void broadcast_received (); - std::vector _worker_threads; + std::vector _worker_threads; std::list > _queue; boost::condition _full_condition; boost::condition _empty_condition; -- 2.30.2