#include "cross.h"
#include "ui_signaller.h"
#include "exceptions.h"
+#include "safe_stringstream.h"
#include "i18n.h"
using std::string;
using std::list;
using std::cout;
-using std::stringstream;
using boost::shared_ptr;
Job::Job (shared_ptr<const Film> f)
set_error (
e.what (),
- _("It is not known what caused this error. The best idea is to report the problem to the DCP-o-matic mailing list (carl@dcpomatic.com)")
+ _("It is not known what caused this error. Please report the problem to the DCP-o-matic author (carl@dcpomatic.com).")
);
set_progress (1);
set_error (
_("Unknown error"),
- _("It is not known what caused this error. The best idea is to report the problem to the DCP-o-matic mailing list (carl@dcpomatic.com)")
+ _("It is not known what caused this error. Please report the problem to the DCP-o-matic author (carl@dcpomatic.com).")
);
set_progress (1);
Job::set_state (State s)
{
bool finished = false;
-
+
{
boost::mutex::scoped_lock lm (_state_mutex);
_state = s;
if (finished && ui_signaller) {
ui_signaller->emit (boost::bind (boost::ref (Finished)));
- }
+ }
}
/** @return Time (in seconds) that this sub-job has been running */
_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) {
}
}
-/** @return fractional progress of this sub-job, or -1 if not known */
+/** @return fractional progress of the current sub-job, or -1 if not known */
float
Job::progress () const
{
pc = 99;
}
- stringstream s;
+ SafeStringStream s;
if (!finished ()) {
s << pc << N_("%");
if (p >= 0 && t > 10 && r > 0) {
{
if (running ()) {
set_state (PAUSED);
+ _pause_changed.notify_all ();
}
}
{
if (paused ()) {
set_state (RUNNING);
+ _pause_changed.notify_all ();
}
}