summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-03-06 22:36:16 +0100
committerCarl Hetherington <cth@carlh.net>2020-03-06 22:36:16 +0100
commitcaf67bef2611a911307267b20dbf3be89ffff71f (patch)
tree66c55e40b1b5a44c8670f8ecb98df2b7ce8bdf68 /src/lib
parentf6557e4bedd788a026d48fe883cb48a1070dc886 (diff)
Stop threads at the start of their object's destruction in all Job cases.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/analyse_audio_job.cc1
-rw-r--r--src/lib/check_content_change_job.cc5
-rw-r--r--src/lib/check_content_change_job.h1
-rw-r--r--src/lib/examine_content_job.cc5
-rw-r--r--src/lib/examine_content_job.h1
-rw-r--r--src/lib/examine_ffmpeg_subtitles_job.cc5
-rw-r--r--src/lib/examine_ffmpeg_subtitles_job.h1
-rw-r--r--src/lib/job.cc5
-rw-r--r--src/lib/send_kdm_email_job.cc5
-rw-r--r--src/lib/send_kdm_email_job.h1
-rw-r--r--src/lib/send_notification_email_job.cc5
-rw-r--r--src/lib/send_notification_email_job.h1
-rw-r--r--src/lib/send_problem_report_job.cc5
-rw-r--r--src/lib/send_problem_report_job.h2
-rw-r--r--src/lib/transcode_job.cc3
-rw-r--r--src/lib/upload_job.cc5
-rw-r--r--src/lib/upload_job.h1
-rw-r--r--src/lib/verify_dcp_job.cc5
-rw-r--r--src/lib/verify_dcp_job.h1
19 files changed, 54 insertions, 4 deletions
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc
index 9d0882b3a..ad28dcfd4 100644
--- a/src/lib/analyse_audio_job.cc
+++ b/src/lib/analyse_audio_job.cc
@@ -83,6 +83,7 @@ AnalyseAudioJob::AnalyseAudioJob (shared_ptr<const Film> film, shared_ptr<const
AnalyseAudioJob::~AnalyseAudioJob ()
{
+ stop_thread ();
BOOST_FOREACH (Filter const * i, _filters) {
delete const_cast<Filter*> (i);
}
diff --git a/src/lib/check_content_change_job.cc b/src/lib/check_content_change_job.cc
index e1226e79c..1df3bc9cd 100644
--- a/src/lib/check_content_change_job.cc
+++ b/src/lib/check_content_change_job.cc
@@ -42,6 +42,11 @@ CheckContentChangeJob::CheckContentChangeJob (shared_ptr<const Film> film, share
}
+CheckContentChangeJob::~CheckContentChangeJob ()
+{
+ stop_thread ();
+}
+
string
CheckContentChangeJob::name () const
{
diff --git a/src/lib/check_content_change_job.h b/src/lib/check_content_change_job.h
index 355dedf83..152cdb9e7 100644
--- a/src/lib/check_content_change_job.h
+++ b/src/lib/check_content_change_job.h
@@ -28,6 +28,7 @@ class CheckContentChangeJob : public Job
{
public:
CheckContentChangeJob (boost::shared_ptr<const Film>, boost::shared_ptr<Job> following = boost::shared_ptr<Job>(), bool gui = true);
+ ~CheckContentChangeJob ();
std::string name () const;
std::string json_name () const;
diff --git a/src/lib/examine_content_job.cc b/src/lib/examine_content_job.cc
index 86e0a107e..3be38863d 100644
--- a/src/lib/examine_content_job.cc
+++ b/src/lib/examine_content_job.cc
@@ -38,6 +38,11 @@ ExamineContentJob::ExamineContentJob (shared_ptr<const Film> film, shared_ptr<Co
}
+ExamineContentJob::~ExamineContentJob ()
+{
+ stop_thread ();
+}
+
string
ExamineContentJob::name () const
{
diff --git a/src/lib/examine_content_job.h b/src/lib/examine_content_job.h
index 424963726..0105035ff 100644
--- a/src/lib/examine_content_job.h
+++ b/src/lib/examine_content_job.h
@@ -27,6 +27,7 @@ class ExamineContentJob : public Job
{
public:
ExamineContentJob (boost::shared_ptr<const Film>, boost::shared_ptr<Content>);
+ ~ExamineContentJob ();
std::string name () const;
std::string json_name () const;
diff --git a/src/lib/examine_ffmpeg_subtitles_job.cc b/src/lib/examine_ffmpeg_subtitles_job.cc
index b9d5f54e5..b2bba11cd 100644
--- a/src/lib/examine_ffmpeg_subtitles_job.cc
+++ b/src/lib/examine_ffmpeg_subtitles_job.cc
@@ -43,6 +43,11 @@ ExamineFFmpegSubtitlesJob::ExamineFFmpegSubtitlesJob (shared_ptr<const Film> fil
}
+ExamineFFmpegSubtitlesJob::~ExamineFFmpegSubtitlesJob ()
+{
+ stop_thread ();
+}
+
string
ExamineFFmpegSubtitlesJob::name () const
{
diff --git a/src/lib/examine_ffmpeg_subtitles_job.h b/src/lib/examine_ffmpeg_subtitles_job.h
index 5960a9cc3..0a0101193 100644
--- a/src/lib/examine_ffmpeg_subtitles_job.h
+++ b/src/lib/examine_ffmpeg_subtitles_job.h
@@ -28,6 +28,7 @@ class ExamineFFmpegSubtitlesJob : public Job, public FFmpeg
{
public:
ExamineFFmpegSubtitlesJob (boost::shared_ptr<const Film>, boost::shared_ptr<FFmpegContent>);
+ ~ExamineFFmpegSubtitlesJob ();
std::string name () const;
std::string json_name () const;
diff --git a/src/lib/job.cc b/src/lib/job.cc
index 04aa227b7..a83249e79 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -62,7 +62,10 @@ Job::Job (shared_ptr<const Film> film)
Job::~Job ()
{
- stop_thread ();
+#ifdef DCPOMATIC_DEBUG
+ /* Any subclass should have called stop_thread in its destructor */
+ assert (!_thread.joinable());
+#endif
}
void
diff --git a/src/lib/send_kdm_email_job.cc b/src/lib/send_kdm_email_job.cc
index 38484b91e..1b476fa63 100644
--- a/src/lib/send_kdm_email_job.cc
+++ b/src/lib/send_kdm_email_job.cc
@@ -53,6 +53,11 @@ SendKDMEmailJob::SendKDMEmailJob (
}
+SendKDMEmailJob::~SendKDMEmailJob ()
+{
+ stop_thread ();
+}
+
string
SendKDMEmailJob::name () const
{
diff --git a/src/lib/send_kdm_email_job.h b/src/lib/send_kdm_email_job.h
index 0b64db7a8..a7196fe15 100644
--- a/src/lib/send_kdm_email_job.h
+++ b/src/lib/send_kdm_email_job.h
@@ -40,6 +40,7 @@ public:
dcp::NameFormat::Map name_values,
std::string cpl_name
);
+ ~SendKDMEmailJob ();
std::string name () const;
std::string json_name () const;
diff --git a/src/lib/send_notification_email_job.cc b/src/lib/send_notification_email_job.cc
index abbb844e2..1c9d96338 100644
--- a/src/lib/send_notification_email_job.cc
+++ b/src/lib/send_notification_email_job.cc
@@ -40,6 +40,11 @@ SendNotificationEmailJob::SendNotificationEmailJob (string body)
}
+SendNotificationEmailJob::~SendNotificationEmailJob ()
+{
+ stop_thread ();
+}
+
string
SendNotificationEmailJob::name () const
{
diff --git a/src/lib/send_notification_email_job.h b/src/lib/send_notification_email_job.h
index 04f1d98ab..5c116f2ee 100644
--- a/src/lib/send_notification_email_job.h
+++ b/src/lib/send_notification_email_job.h
@@ -24,6 +24,7 @@ class SendNotificationEmailJob : public Job
{
public:
explicit SendNotificationEmailJob (std::string body);
+ ~SendNotificationEmailJob ();
std::string name () const;
std::string json_name () const;
diff --git a/src/lib/send_problem_report_job.cc b/src/lib/send_problem_report_job.cc
index 11f700de0..d27609f0b 100644
--- a/src/lib/send_problem_report_job.cc
+++ b/src/lib/send_problem_report_job.cc
@@ -52,6 +52,11 @@ SendProblemReportJob::SendProblemReportJob (
}
+SendProblemReportJob::~SendProblemReportJob ()
+{
+ stop_thread ();
+}
+
string
SendProblemReportJob::name () const
{
diff --git a/src/lib/send_problem_report_job.h b/src/lib/send_problem_report_job.h
index c4371a54e..af1a4b269 100644
--- a/src/lib/send_problem_report_job.h
+++ b/src/lib/send_problem_report_job.h
@@ -31,6 +31,8 @@ public:
std::string summary
);
+ ~SendProblemReportJob ();
+
std::string name () const;
std::string json_name () const;
void run ();
diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc
index 7fe28d210..fb586b082 100644
--- a/src/lib/transcode_job.cc
+++ b/src/lib/transcode_job.cc
@@ -54,9 +54,6 @@ TranscodeJob::TranscodeJob (shared_ptr<const Film> film)
TranscodeJob::~TranscodeJob ()
{
- /* We have to stop the job thread here as we're about to start tearing down
- the Encoder, which is bad news if the job thread is still feeding it data.
- */
stop_thread ();
}
diff --git a/src/lib/upload_job.cc b/src/lib/upload_job.cc
index b229fddbe..fbfbb92d8 100644
--- a/src/lib/upload_job.cc
+++ b/src/lib/upload_job.cc
@@ -46,6 +46,11 @@ UploadJob::UploadJob (shared_ptr<const Film> film)
}
+UploadJob::~UploadJob ()
+{
+ stop_thread ();
+}
+
string
UploadJob::name () const
{
diff --git a/src/lib/upload_job.h b/src/lib/upload_job.h
index 407094ab8..3a613fd72 100644
--- a/src/lib/upload_job.h
+++ b/src/lib/upload_job.h
@@ -28,6 +28,7 @@ class UploadJob : public Job
{
public:
explicit UploadJob (boost::shared_ptr<const Film>);
+ ~UploadJob ();
std::string name () const;
std::string json_name () const;
diff --git a/src/lib/verify_dcp_job.cc b/src/lib/verify_dcp_job.cc
index 908cd53a7..c1dcbc792 100644
--- a/src/lib/verify_dcp_job.cc
+++ b/src/lib/verify_dcp_job.cc
@@ -36,6 +36,11 @@ VerifyDCPJob::VerifyDCPJob (vector<boost::filesystem::path> directories)
}
+VerifyDCPJob::~VerifyDCPJob ()
+{
+ stop_thread ();
+}
+
string
VerifyDCPJob::name () const
{
diff --git a/src/lib/verify_dcp_job.h b/src/lib/verify_dcp_job.h
index a93a7adfa..2cff5ab6c 100644
--- a/src/lib/verify_dcp_job.h
+++ b/src/lib/verify_dcp_job.h
@@ -28,6 +28,7 @@ class VerifyDCPJob : public Job
{
public:
explicit VerifyDCPJob (std::vector<boost::filesystem::path> directories);
+ ~VerifyDCPJob ();
std::string name () const;
std::string json_name () const;