using boost::optional;
using boost::function;
-#define LOG_ERROR_NC(...) _film->log()->log (__VA_ARGS__, Log::TYPE_ERROR);
+#define LOG_ERROR_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_ERROR);
+/** @param film Associated film, or 0 */
Job::Job (shared_ptr<const Film> film)
: _film (film)
, _thread (0)
{
if (_thread) {
_thread->interrupt ();
+ DCPOMATIC_ASSERT (_thread->joinable ());
_thread->join ();
}
void
Job::set_error (string s, string d)
{
- LOG_ERROR_NC (s);
- LOG_ERROR_NC (d);
+ if (_film) {
+ LOG_ERROR_NC (s);
+ LOG_ERROR_NC (d);
+ _film->log()->log (String::compose ("Error in job: %1 (%2)", s, d), LogEntry::TYPE_ERROR);
+ }
- _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;
_error_details = d;
}
_thread->interrupt ();
+ DCPOMATIC_ASSERT (_thread->joinable ());
_thread->join ();
+ delete _thread;
+ _thread = 0;
}
void
connection = Finished.connect (finished);
}
}
-