J2KEncoder::~J2KEncoder ()
{
+ boost::mutex::scoped_lock lm (_threads_mutex);
terminate_threads ();
}
LOG_GENERAL_NC (N_("Terminating encoder threads"));
- terminate_threads ();
+ {
+ boost::mutex::scoped_lock lm (_threads_mutex);
+ terminate_threads ();
+ }
/* Something might have been thrown during terminate_threads */
rethrow ();
_last_player_video_time = time;
}
+
+/** Caller must hold a lock on _threads_mutex */
void
J2KEncoder::terminate_threads ()
{
boost::this_thread::disable_interruption dis;
- boost::mutex::scoped_lock lm (_threads_mutex);
if (!_threads) {
return;
void
J2KEncoder::servers_list_changed ()
{
+ boost::mutex::scoped_lock lm (_threads_mutex);
+
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 ()) {