diff options
author | Max Kellermann <max@duempel.org> | 2014-10-11 21:57:31 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-10-11 21:57:31 +0200 |
commit | 7cd53fb4527cf6a28b6defd673100d9ea870076d (patch) | |
tree | 830bda748d5245118612c006afb07221eb08642d | |
parent | 538ddf7af242ef73f9552e21dfed696d9d7897ba (diff) | |
download | mpd-7cd53fb4527cf6a28b6defd673100d9ea870076d.tar.gz mpd-7cd53fb4527cf6a28b6defd673100d9ea870076d.tar.xz mpd-7cd53fb4527cf6a28b6defd673100d9ea870076d.zip |
ThreadInputStream: add assertions
-rw-r--r-- | src/input/ThreadInputStream.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/input/ThreadInputStream.cxx b/src/input/ThreadInputStream.cxx index dc08f3b6b..821ce3e4a 100644 --- a/src/input/ThreadInputStream.cxx +++ b/src/input/ThreadInputStream.cxx @@ -118,6 +118,8 @@ ThreadInputStream::ThreadFunc(void *ctx) bool ThreadInputStream::Check(Error &error) { + assert(!thread.IsInside()); + if (postponed_error.IsDefined()) { error = std::move(postponed_error); return false; @@ -129,12 +131,16 @@ ThreadInputStream::Check(Error &error) bool ThreadInputStream::IsAvailable() { + assert(!thread.IsInside()); + return !buffer->IsEmpty() || eof || postponed_error.IsDefined(); } inline size_t ThreadInputStream::Read(void *ptr, size_t read_size, Error &error) { + assert(!thread.IsInside()); + while (true) { if (postponed_error.IsDefined()) { error = std::move(postponed_error); @@ -161,5 +167,7 @@ ThreadInputStream::Read(void *ptr, size_t read_size, Error &error) bool ThreadInputStream::IsEOF() { + assert(!thread.IsInside()); + return eof; } |