diff options
author | Max Kellermann <max@duempel.org> | 2014-05-11 15:34:48 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-05-11 15:34:48 +0200 |
commit | 6773adc7716eea7656c4590b54f7c99840ff4087 (patch) | |
tree | b71756798018721f3aa472ce1b81aa14e84239b8 /src/input/ThreadInputStream.cxx | |
parent | ee2afb35dd715d9f34a938cd54ed02a3c0091a78 (diff) | |
download | mpd-6773adc7716eea7656c4590b54f7c99840ff4087.tar.gz mpd-6773adc7716eea7656c4590b54f7c99840ff4087.tar.xz mpd-6773adc7716eea7656c4590b54f7c99840ff4087.zip |
InputStream: convert to class
Diffstat (limited to 'src/input/ThreadInputStream.cxx')
-rw-r--r-- | src/input/ThreadInputStream.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/input/ThreadInputStream.cxx b/src/input/ThreadInputStream.cxx index 5271171ef..fde9bd08e 100644 --- a/src/input/ThreadInputStream.cxx +++ b/src/input/ThreadInputStream.cxx @@ -58,18 +58,17 @@ ThreadInputStream::Start(Error &error) inline void ThreadInputStream::ThreadFunc() { - FormatThreadName("input:%s", base.plugin.name); + FormatThreadName("input:%s", base.GetPlugin().name); - base.mutex.lock(); + Lock(); if (!Open(postponed_error)) { base.cond.broadcast(); - base.mutex.unlock(); + Unlock(); return; } /* we're ready, tell it to our client */ - base.ready = true; - base.cond.broadcast(); + base.SetReady(); while (!close) { assert(!postponed_error.IsDefined()); @@ -78,12 +77,12 @@ ThreadInputStream::ThreadFunc() if (w.IsEmpty()) { wake_cond.wait(base.mutex); } else { - base.mutex.unlock(); + Unlock(); Error error; size_t nbytes = Read(w.data, w.size, error); - base.mutex.lock(); + Lock(); base.cond.broadcast(); if (nbytes == 0) { @@ -96,7 +95,7 @@ ThreadInputStream::ThreadFunc() } } - base.mutex.unlock(); + Unlock(); Close(); } @@ -173,10 +172,10 @@ ThreadInputStream::Read(InputStream *is, void *ptr, size_t size, inline void ThreadInputStream::Close2() { - base.mutex.lock(); + Lock(); close = true; wake_cond.signal(); - base.mutex.unlock(); + Unlock(); Cancel(); |