X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fjob.cc;h=5b0b9c6044475a0b11c5e84318b09df409c60908;hb=ba5a89098782cc61563841fbd5976c98b141ad54;hp=1d3cb73b6fcf39f276e9aefc3fbdd91841397051;hpb=1c13441a19aa387ddd8ac0c972207ccbbe3114d8;p=dcpomatic.git diff --git a/src/lib/job.cc b/src/lib/job.cc index 1d3cb73b6..5b0b9c604 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -39,6 +39,8 @@ using std::list; using std::cout; using boost::shared_ptr; +#define LOG_ERROR_NC(...) _film->log()->log (__VA_ARGS__, Log::TYPE_ERROR); + Job::Job (shared_ptr f) : _film (f) , _thread (0) @@ -109,7 +111,7 @@ Job::run_wrapper () set_error ( e.what (), - _("It is not known what caused this error. Please report the problem to the DCP-o-matic author (carl@dcpomatic.com).") + string (_("It is not known what caused this error.")) + " " + REPORT_PROBLEM ); set_progress (1); @@ -119,7 +121,7 @@ Job::run_wrapper () set_error ( _("Unknown error"), - _("It is not known what caused this error. Please report the problem to the DCP-o-matic author (carl@dcpomatic.com).") + string (_("It is not known what caused this error.")) + " " + REPORT_PROBLEM ); set_progress (1); @@ -231,8 +233,9 @@ Job::set_progress (float p, bool force) _progress = p; boost::this_thread::interruption_point (); - if (paused ()) { - dcpomatic_sleep (1); + boost::mutex::scoped_lock lm2 (_state_mutex); + while (_state == PAUSED) { + _pause_changed.wait (lm2); } if (ui_signaller) { @@ -280,6 +283,9 @@ Job::error_summary () const void Job::set_error (string s, string d) { + LOG_ERROR_NC (s); + LOG_ERROR_NC (d); + _film->log()->log (String::compose ("Error in job: %1 (%2)", s, d), Log::TYPE_ERROR); boost::mutex::scoped_lock lm (_state_mutex); _error_summary = s; @@ -350,6 +356,7 @@ Job::pause () { if (running ()) { set_state (PAUSED); + _pause_changed.notify_all (); } } @@ -358,5 +365,6 @@ Job::resume () { if (paused ()) { set_state (RUNNING); + _pause_changed.notify_all (); } }