aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/ThreadInputStream.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-05-11 16:59:19 +0200
committerMax Kellermann <max@duempel.org>2014-05-11 17:12:50 +0200
commit82337dec44347017ca04fe975e85e6d9e4edb635 (patch)
tree308036d4a7abbd2bb04ed472dc1fbacdc2587871 /src/input/ThreadInputStream.cxx
parentf1d07002521a4a98acf130127cf42aef20a5e258 (diff)
downloadmpd-82337dec44347017ca04fe975e85e6d9e4edb635.tar.gz
mpd-82337dec44347017ca04fe975e85e6d9e4edb635.tar.xz
mpd-82337dec44347017ca04fe975e85e6d9e4edb635.zip
InputStream: add virtual destructor
Replaces the method Close().
Diffstat (limited to '')
-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()
{