73ebb92e9df01ba7afb97121b6e2cef6ca13a18e
I'm not sure why it was removed, and it seems necessary;
servers_list_changed() can be called from a variety of different places
(the constructor and two different EncodeServerFinder threads).
May help with #1854.
- size_t threads = _threads->size();
+ size_t threads = 0;
+ {
+ boost::mutex::scoped_lock lm (_threads_mutex);
+ threads = _threads->size();
+ }
boost::mutex::scoped_lock queue_lock (_queue_mutex);
boost::mutex::scoped_lock queue_lock (_queue_mutex);
J2KEncoder::terminate_threads ()
{
boost::this_thread::disable_interruption dis;
J2KEncoder::terminate_threads ()
{
boost::this_thread::disable_interruption dis;
+ boost::mutex::scoped_lock lm (_threads_mutex);
terminate_threads ();
_threads.reset (new boost::thread_group());
terminate_threads ();
_threads.reset (new boost::thread_group());
+ boost::mutex::scoped_lock lm (_threads_mutex);
+
/* XXX: could re-use threads */
if (!Config::instance()->only_servers_encode ()) {
/* XXX: could re-use threads */
if (!Config::instance()->only_servers_encode ()) {
+ boost::mutex _threads_mutex;
boost::shared_ptr<boost::thread_group> _threads;
mutable boost::mutex _queue_mutex;
boost::shared_ptr<boost::thread_group> _threads;
mutable boost::mutex _queue_mutex;