Commit 302c0515 authored by Max Kellermann's avatar Max Kellermann

input/buffering: move code to RunThreadLocked()

parent 19e4672a
......@@ -134,13 +134,9 @@ BufferingInputStream::FindFirstHole() const noexcept
return INVALID_OFFSET;
}
void
BufferingInputStream::RunThread() noexcept
inline void
BufferingInputStream::RunThreadLocked(std::unique_lock<Mutex> &lock) noexcept
{
SetThreadName("buffering");
std::unique_lock<Mutex> lock(mutex);
while (!stop) {
if (seek) {
try {
......@@ -256,6 +252,16 @@ BufferingInputStream::RunThread() noexcept
} else
wake_cond.wait(lock);
}
}
void
BufferingInputStream::RunThread() noexcept
{
SetThreadName("buffering");
std::unique_lock<Mutex> lock(mutex);
RunThreadLocked(lock);
/* clear the "input" attribute while holding the mutex */
auto _input = std::move(input);
......
......@@ -88,6 +88,7 @@ protected:
private:
size_t FindFirstHole() const noexcept;
void RunThreadLocked(std::unique_lock<Mutex> &lock) noexcept;
void RunThread() noexcept;
/* virtual methods from class InputStreamHandler */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment