{
_waker.nudge ();
- 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);
J2KEncoder::terminate_threads ()
{
boost::this_thread::disable_interruption dis;
+ boost::mutex::scoped_lock lm (_threads_mutex);
if (!_threads) {
return;
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 ()) {