Add some more logging when finishing up an encode.
authorCarl Hetherington <cth@carlh.net>
Sun, 23 Sep 2012 19:13:04 +0000 (20:13 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 23 Sep 2012 19:13:04 +0000 (20:13 +0100)
src/lib/j2k_wav_encoder.cc

index ef1e8edc1b1728285276163c0f4f2c129769387c..9ae01c774287256e667f3d490eeb3a8914b29bad 100644 (file)
@@ -27,6 +27,7 @@
 #include <iostream>
 #include <boost/thread.hpp>
 #include <boost/filesystem.hpp>
+#include <boost/lexical_cast.hpp>
 #include <sndfile.h>
 #include <openjpeg.h>
 #include "j2k_wav_encoder.h"
@@ -229,8 +230,11 @@ J2KWAVEncoder::process_end ()
 {
        boost::mutex::scoped_lock lock (_worker_mutex);
 
+       _log->log ("Clearing queue of " + lexical_cast<string> (_queue.size ()));
+
        /* Keep waking workers until the queue is empty */
        while (!_queue.empty ()) {
+               _log->log ("Waking with " + lexical_cast<string> (_queue.size ()));
                _worker_condition.notify_all ();
                _worker_condition.wait (lock);
        }
@@ -239,6 +243,8 @@ J2KWAVEncoder::process_end ()
        
        terminate_worker_threads ();
 
+       _log->log ("Mopping up " + lexical_cast<string> (_queue.size()));
+
        /* The following sequence of events can occur in the above code:
             1. a remote worker takes the last image off the queue
             2. the loop above terminates