summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-09-01 21:05:25 +0100
committerCarl Hetherington <cth@carlh.net>2015-09-01 21:05:25 +0100
commitcefba53fe130807e96e608ad3bbb87786b654c6e (patch)
treed3a4eb003ec3d66289c7b045cc46cf618a54d367
parent0ec7c9d0b1f3ea58ffe17dd70bea04ad702d164b (diff)
Don't start thread in constructor. (Writer)
-rw-r--r--src/lib/transcoder.cc1
-rw-r--r--src/lib/writer.cc9
-rw-r--r--src/lib/writer.h2
3 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc
index 27e35ac52..4e8932268 100644
--- a/src/lib/transcoder.cc
+++ b/src/lib/transcoder.cc
@@ -62,6 +62,7 @@ Transcoder::Transcoder (shared_ptr<const Film> film, shared_ptr<Job> j)
void
Transcoder::go ()
{
+ _writer->start ();
_encoder->begin ();
DCPTime const frame = DCPTime::from_frames (1, _film->video_frame_rate ());
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 9c4a194e8..0e15edeca 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -148,12 +148,11 @@ Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j)
}
job->sub (_("Encoding image data"));
+}
- /* Do this last; if something after this line were to throw an exception
- (say if Job::sub was interrupted by cancel) this thread would never
- get properly cleaned up but the Writer object would go away underneath
- it.
- */
+void
+Writer::start ()
+{
_thread = new boost::thread (boost::bind (&Writer::thread, this));
}
diff --git a/src/lib/writer.h b/src/lib/writer.h
index be1d3f69e..cec6ba527 100644
--- a/src/lib/writer.h
+++ b/src/lib/writer.h
@@ -97,6 +97,8 @@ public:
Writer (boost::shared_ptr<const Film>, boost::weak_ptr<Job>);
~Writer ();
+ void start ();
+
bool can_fake_write (int) const;
void write (Data, int, Eyes);