Yet more waking (in hash computation).
authorCarl Hetherington <cth@carlh.net>
Mon, 4 Nov 2019 23:04:21 +0000 (00:04 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 4 Nov 2019 23:04:21 +0000 (00:04 +0100)
src/lib/cross.cc
src/lib/cross.h
src/lib/writer.cc

index 1b83bad7c6dca9a02cf9696eccf8c8834f0fa8b7..dcd4ddfd884b695ee2af4360605f4952702b2fce 100644 (file)
@@ -337,6 +337,7 @@ void
 Waker::nudge ()
 {
 #ifdef DCPOMATIC_WINDOWS
 Waker::nudge ()
 {
 #ifdef DCPOMATIC_WINDOWS
+       boost::mutex::scoped_lock lm (_mutex);
        SetThreadExecutionState (ES_SYSTEM_REQUIRED);
 #endif
 }
        SetThreadExecutionState (ES_SYSTEM_REQUIRED);
 #endif
 }
@@ -344,6 +345,7 @@ Waker::nudge ()
 Waker::Waker ()
 {
 #ifdef DCPOMATIC_OSX
 Waker::Waker ()
 {
 #ifdef DCPOMATIC_OSX
+       boost::mutex::scoped_lock lm (_mutex);
        /* We should use this */
         // IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id);
        /* but it's not available on 10.5, so we use this */
        /* We should use this */
         // IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id);
        /* but it's not available on 10.5, so we use this */
@@ -354,6 +356,7 @@ Waker::Waker ()
 Waker::~Waker ()
 {
 #ifdef DCPOMATIC_OSX
 Waker::~Waker ()
 {
 #ifdef DCPOMATIC_OSX
+       boost::mutex::scoped_lock lm (_mutex);
        IOPMAssertionRelease (_assertion_id);
 #endif
 }
        IOPMAssertionRelease (_assertion_id);
 #endif
 }
index 4067631bcf134a2200ae04b961ae4d609b7e1cba..67709463ae4163e8ca86b1864618426b412f2d1d 100644 (file)
@@ -29,6 +29,7 @@
 #include <IOKit/pwr_mgt/IOPMLib.h>
 #endif
 #include <boost/filesystem.hpp>
 #include <IOKit/pwr_mgt/IOPMLib.h>
 #endif
 #include <boost/filesystem.hpp>
+#include <boost/thread/mutex.hpp>
 
 #ifdef DCPOMATIC_WINDOWS
 #define WEXITSTATUS(w) (w)
 
 #ifdef DCPOMATIC_WINDOWS
 #define WEXITSTATUS(w) (w)
@@ -74,6 +75,7 @@ public:
        void nudge ();
 
 private:
        void nudge ();
 
 private:
+       boost::mutex _mutex;
 #ifdef DCPOMATIC_OSX
        IOPMAssertionID _assertion_id;
 #endif
 #ifdef DCPOMATIC_OSX
        IOPMAssertionID _assertion_id;
 #endif
index 915376055b31f9f55561dc7a5ca6b48fa44746a9..48f40334ab98825478545412a60d309da6ea98dd 100644 (file)
@@ -780,4 +780,7 @@ Writer::set_digest_progress (Job* job, float progress)
        }
 
        job->set_progress (min_progress);
        }
 
        job->set_progress (min_progress);
+
+       Waker waker;
+       waker.nudge ();
 }
 }