aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/ThreadInputStream.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/ThreadInputStream.cxx')
-rw-r--r--src/input/ThreadInputStream.cxx31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/input/ThreadInputStream.cxx b/src/input/ThreadInputStream.cxx
index 0f503be3f..408b757f9 100644
--- a/src/input/ThreadInputStream.cxx
+++ b/src/input/ThreadInputStream.cxx
@@ -29,6 +29,15 @@
ThreadInputStream::~ThreadInputStream()
{
+ Lock();
+ close = true;
+ wake_cond.signal();
+ Unlock();
+
+ Cancel();
+
+ thread.Join();
+
if (buffer != nullptr) {
buffer->Clear();
HugeFree(buffer->Write().data, buffer_size);
@@ -172,28 +181,6 @@ ThreadInputStream::Read(InputStream *is, void *ptr, size_t size,
return tis.Read2(ptr, size, error);
}
-inline void
-ThreadInputStream::Close2()
-{
- Lock();
- close = true;
- wake_cond.signal();
- Unlock();
-
- Cancel();
-
- thread.Join();
-
- delete this;
-}
-
-void
-ThreadInputStream::Close(InputStream *is)
-{
- ThreadInputStream &tis = *(ThreadInputStream *)is;
- tis.Close2();
-}
-
inline bool
ThreadInputStream::IsEOF2()
{